Can not import customize module in openERP

前端 未结 6 764
梦毁少年i
梦毁少年i 2021-01-20 10:35

i have done simple customize module in openerp with using python and xml. but I cannot import in openerp. My module is not shown in openerp.

this is

相关标签:
6条回答
  • 2021-01-20 10:59

    The only issue i can see here is that your openerp.py file name is not correct the name should be __openerp__, plus in the __init__.py file you should import the sim.py file, and no need to import all of those modules that you wrote there, keep only the necessary libraries and modules you need.

    0 讨论(0)
  • 2021-01-20 10:59

    In order to see a custom module in OpenERP 7, it must first be in the addons directory.

    Go to Settings > Modules > Update Modules List

    Click Update

    You must have Technical Features enabled for the user you are logged in as.

    Then go to Settings > Modules > Installed Modules

    Remove the [Installed] filter and search for your custom module.

    Custom modules will not appear in Settings > Modules > Apps because that view will only display Modules/Apps that are found online.

    0 讨论(0)
  • 2021-01-20 11:05

    As @Zak said, __init__.py need only need to import the sim which is the python file you are using in the module. In __openerp__.py file, i cant find any error. The problem I found is in the sim.py file!!! You are importing only fields from openerp.osv. Your class is now inheriting the osv folder. Your class should inherit the osv file's osv class(class name: Model ). For openerp functionality, you have to import osv from openerp.osv. Please modify the sim.py with from openerp.osv import osv, fields.

    0 讨论(0)
  • 2021-01-20 11:15

    this will work fine. Try this. Update all your files.

    __openerp__.py   File
    
    {
    'name': 'Student Information Management',
    'version': '0.1',
    'category': 'Tools',
    'description': """This module is for the Student Information Management.""",
    'author': 'Mir Nauman Tahir',
        'website': 'http://mirnauman.wordpress.com/',
    'depends': ['base'],
    'data': ['sim_view.xml'],
    'demo': [],
    'installable': True,
        'auto_install': False,
        'application': True,
    
    }
    
    
     __init__.py File
    
    import sim
    
    
    
    
    sim.py File
    
    
    from openerp.osv import fields, osv
    class student(osv.osv):
    _name = "sim.student"
    _description = "This table is for keeping personal data of student"
    _columns = {
        'name': fields.char('Registration Number',size=256,required=True),
        'student_name': fields.char('Student Name',size=256,required=True),
        'father_name': fields.char('Father Name',size=256),
        'gender':fields.selection([('male','Male'),('female','Female')],'Gender'),
        'contact_no':fields.char('Contact Number',size=256)
    }
    student()
    
    
    sim_view.xml File
    
    <?xml version="1.0"?>
    <openerp>
    <data>
    <!-- ============== student================= -->
    <!-- 1st part of the sim_view start-->
    <record model="ir.ui.view" id="student_form">
    <field name="name">Student</field>
    <field name="model">sim.student</field>
    <field name="type">form</field>
    <field name="arch" type="xml">
    <form string="Student" version="7.0">
    <group>
    <field name="name"/>
    <field name="student_name"/>
    <field name="father_name"/>
    <field name="gender"/>
    <field name="contact_no"/>
    </group>
    </form>
    </field>
    </record>
    <!-- 1st part of the sim_view end-->
    <!--2nd part of the sim_view start-->
    <record model="ir.ui.view" id="student_tree">
    <field name="name">Student</field>
    <field name="model">sim.student</field>
    <field name="type">tree</field>
    <field name="arch" type="xml">
    <tree string="Student">
    <field name="name"/>
    <field name="student_name"/>
    <field name="father_name"/>
    <field name="gender"/>
    <field name="contact_no"/>
    </tree>
    </field>
    </record>
    <!--2nd part of the sim_view end-->
    <!-- 3rd part of the sim_view start-->
    <record model="ir.actions.act_window" id="action_student">
    <field name="name">Student</field>
    <field name="res_model">sim.student</field>
    <field name="view_type">form</field>
    <field name="view_mode">tree,form</field>
    </record>
    <!--3rd part of the sim_view end-->
    <!--4th part of the sim_view start-->
    <menuitem name="SIM/Student/StudentInfo" id="menu_sim_student"  
          action="action_student"/>
    <!--4th part of the sim_view end-->
    </data>
    </openerp>
    

    After updating all your files, Restart the server, update module list and find your module in Settings > Modules > Installed Modules - remove installed from there and write your module's name (i.e sim) over there.

    Hope this will definitely work.

    0 讨论(0)
  • 2021-01-20 11:15

    Once again Make sure that you have put your module inside addons directory where all
    the other modules exists. not inside server's addons, it should be inside main addons.

       Hope this will solve your problem
    
    0 讨论(0)
  • 2021-01-20 11:16

    f you want to see a custom module in OpenERP 7, it must first be in the addons directory.

    Go to Settings > Modules > Update Modules List

    Click Update

    You must have Technical Features enabled for the user you are logged in as.

    Then go to Settings > Modules > Installed Modules

    Remove the [Installed] filter and search for your custom module.

    Custom modules will not appear in Settings > Modules > Apps because that view will only display Modules/Apps that are found online.

    0 讨论(0)
提交回复
热议问题