This question has been flagged
3 Replies
3013 Views

I followed a tutorial on how to create a module (https://doc.openerp.com/trunk/web/module/) but i am getting a lot of errors.

Errors: http://pastebin.com/rBpg9uuf

Basically, i copied and pasted every bit of code i've seen in that tutorial (While reading, obviously)

__openerp__.py : http://pastebin.com/xY9tcBuW

__init__.py : http://pastebin.com/3J73Y9r7

 

I am using OpenERP 7.

Thanks

 

 

Avatar
Discard
Best Answer

Joao,

Please provide the xml file here.

The error sayas that, the xml file line 11 contains menuitem tag which breaks the xml validation.

You might see your terminal which will show you the xml file record with exact description of error.

If not, please share your xml file here so one can help you get rid of the error.

Thanks.

Avatar
Discard
Author Best Answer

Fixed the error.

 

Don't know hwy, but i had some random menu tags on my xml file. Thanks for pointing that!

Avatar
Discard
Best Answer

Hi,

Here I explain how to create a basic module in openerp .please follow the foldr structure of modules 

 

init.py----------------------

import barcode_info

 

opeenrp.py----------------------

 

{
'name':'Barcode Generator',
'version':'0.0',
'author':'Libu',
'depends':['base'],
'update_xml' : ['barcode_view.xml'
                                ],
'installable':True,
'category':'General',
'description':'Barcode Geneartor Module',
'website':'',
'demo':[]
}

 

barcode_info.py-----------------

from osv import osv,fields


class barcode_info(osv.osv):
   
    _name='barcode.info'
    
    _columns={
            
             'barcode_id':fields.integer('Product code'),
             'barcode_ref':fields.integer('Reference #'),
             'barcode_price':fields.integer('weight/price'),
             'barcode_name':fields.integer('Barcode'),
             }
       
    def button_generate(self,cr,uid,ids,context=None):
        print " put your code here "
        return True
    
barcode_info()

 

barcode_view.xml----------------------

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        
        <record id="barcode_info_tree" model="ir.ui.view">
                <field name="name">barcode.information</field>
                <field name="model">barcode.info</field>
                <field name="arch" type="xml">
                    <tree string="Barcode">                                    
                        <field name="barcode_id"/>                
                        <field name="barcode_ref"/>
                        <field name="barcode_price"/>
                        <field name="barcode_name"/>
                        
                    </tree>
                </field>                
        </record>
    
        
                <record id="barcode_info_form" model="ir.ui.view">
                <field name="name">barcode.information</field>
                <field name="model">barcode.info</field>
                <field name="arch" type="xml">
                    <form string="Barcode Information">                                    
                        <field name="barcode_id"/>                
                        <field name="barcode_ref"/>
                        <field name="barcode_price"/>
                        <field name="barcode_name"/>
                        

                            <button name="button_generate" string="Generate"
                         class="oe_highlight" type="object"/>    
                             
                             </form>
                         
                     
                </field>                
        </record>
        
        
        <record id="barcode_id_action" model="ir.actions.act_window">
        <field name="name">Barcode Geneartor</field>
        <field name="res_model">barcode.info</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
    </record>
        
        
        
        <menuitem id="menu_barcode_main" name="Barcode" />
        <menuitem id="menu_barcode_sub" name="Barcode Generation" parent="menu_barcode_main"/>
        <menuitem id="menu_barcode_sub1" name="Generate" parent="menu_barcode_sub" action="barcode_id_action"/>
        

                                </data>
        
            </openerp>

 

 

Avatar
Discard