Odoo Help


understanding custom module one2many field

on 1/5/14, 5:09 PM 623 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


     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'),

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'),



<?xml version="1.0" encoding="utf-8"?>
    <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>

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 1/5/14, 5:09 PM
Seen: 623 times
Last updated: 3/16/15, 8:10 AM