This question has been flagged
3643 Views

I'm dos not understand how to add module to existing form. i want add a new one2many field to product.normal.form

i'm get error xml view one install module

module.py

     from openerp.osv import osv, fields 

    class product_product(osv.osv):
        _name = 'product.product'
        _inherit = 'product.product'
        _columns = {
                    'product_category' : fields.selection([('Tubes','Tubes'),('Spotlight','Spotlight'),('Downlight','Downlight'),('Floodlight','Floodlight'),('LedJet','LedJet')],'Pruduct Category'),
                    'sokel_type': fields.one2many('dev.sokel_type', 'sokel_id', 'Sokel Type'),
     }
    product_product()

class dev_sokel_type(osv.osv):
    _name = "dev.sokel_type"
    _description = "Sokel type"
    _columns = {
        'sokel_id': fields.many2one('product.product', 'Sokel ID', ondelete='cascade',select=True),
        'name': fields.char('Sokel Type', size=15, required=False),
        'description': fields.text('Description'),
    }

dev_sokel_type()

update.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
  <data>
    <record id="drei_led_product_normal_form_view" model="ir.ui.view">
    <field name="name">product.normal.form</field>
    <field name="model">product.product</field>
    <field name="inherit_id" ref="product.product_normal_form_view"/>
    <field name="arch" type="xml">
     <xpath expr="/form/sheet/notebook/page[@string='Information']/group/group/field[@name='list_price']" position="after">
     <field name="product_category"/>
   <field name="sokel_type" widget="one2many_list" nolabel="1" context="{'sokel_id':active_id}" class="oe_inline oe_no_button"/>

</xpath> </field> </record> </data> </openerp>

Avatar
Discard