Tạo 1 module test nhưng chưa được update lên hệ thống

Thảo luận trong 'Hỏi - Đáp' bắt đầu bởi dungchip, 25/2/18.

  1. dungchip New Member

    Hi mọi người, mình có tạo 1 module đơn giản nhưng khi tạo xong và Run thì chưa được update lên hệ thống ?
    path module : ../addons/book_manager/
    - Tên module: book_manager
    gồm 4 file sa:
    1. __init__.py
    import book_manager

    2. __openerp__.py
    # -*- encoding: utf-8 -*-
    ##############################################################################
    #
    # OpenERP, Open Source Management Solution
    # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
    # $Id$
    #
    # This program is free software: you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation, either version 3 of the License, or
    # (at your option) any later version.
    #
    # This program is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    # GNU General Public License for more details.
    #
    # You should have received a copy of the GNU General Public License
    # along with this program. If not, see <http://www.gnu.org/licenses/>.
    #
    ##############################################################################

    {
    "name" : "Book Management", # tên module
    "version": "1.0", # version
    "author" : "mokepigu", # tác giả
    "website" : "http://www.mokepigu.wordpress.com", # website
    "category" : "Generic Modules", # thuộc category nào
    "depends" : ["base"], # list các module phải có trước khi cài module này
    "description": """Book Management Description""", # mô tả cho module
    "init_xml" : [],
    "demo_xml" : [], # đường dẫn tương đối tới file dữ liệu demo
    "update_xml": [ # các file tạo view
    "book_view.xml",
    ],
    'demo_xml': [],
    'installable': True, # True or False, module này có thể được cài đặt hay ko?
    'active': False, # True or False, module này có thể được cài ngay lúc tạo database hay ko?, mặc định là False
    'certificate': '0075116868317', # id của module
    }
    # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
    3. book_manager.py
    from openerp.osv import fields, osv
    import time

    class book_book(osv.osv):
    _name = 'book.book' # name of object
    _columns = {
    'name': fields.char('Name', size=64, required=True),
    'author': fields.char('Author', size=64, required=True),
    'publisher': fields.char('Publisher', size=64, required=True),
    'publish_date': fields.date('Publish Date'),
    'description' : fields.text('Description'),
    }
    _defaults = {

    }
    book_book()
    4. book_view.xml
    <?xml version="1.0" encoding="utf-8"?>
    <openerp>
    <data>
    <menuitem icon="terp-graph" id="book_menu" name="Book Management"/>

    <record id="view_book_tree" model="ir.ui.view">
    <field name="name">book.book.tree</field>
    <field name="model">book.tree</field>
    <field name="type">tree</field>
    <field name="arch" type="xml">
    <tree string="Notes">
    <field name="name"/>
    <field name="author"/>
    <field name="publisher"/>
    <field name="publish_date"/>
    <field name="description"/>
    </tree>
    </field>
    </record>
    <record id="view_book_form" model="ir.ui.view">
    <field name="name">book.book.form</field>
    <field name="model">book.book</field>
    <field name="type">form</field>
    <field name="arch" type="xml">
    <form string="Note">
    <field name="name" select="1"/>
    <field name="author" select="1"/>
    <field name="publisher" select="1"/>
    <field name="publish_date"/>
    <field name="description"/>
    </form>
    </field>
    </record>
    <record id="action_view_book_book_form" model="ir.actions.act_window">
    <field name="name">Create a new book</field>
    <field name="res_model">book.book</field>
    <field name="view_type">form</field>
    <field name="view_mode">form,tree</field>
    </record>

    <menuitem action="action_view_book_book_form"
    id="menu_view_book_form"
    parent="book_menu"/>
    </data>
    </openerp>
  2. Bùi Ngọc Tú New Member

Chia sẻ trang này