1
votes

I have created a custom module to add field constructor in the product template. I'm using odoo 9 . My field was added in the view but when i want to modify an old product or to create a new one it shows this error. Any help please ?

Uncaught TypeError: Cannot read property 'fields' of undefined
http://localhost:8069/web/static/src/js/views/form_view.js:496
Retraçage :
TypeError: Cannot read property 'fields' of undefined
at http://localhost:8069/web/static/src/js/views/form_view.js:496:29
at Function._.each._.forEach (http://localhost:8069/web/static/lib/underscore/underscore.js:150:9)
at http://localhost:8069/web/static/src/js/views/form_view.js:495:15
at Function._.each._.forEach (http://localhost:8069/web/static/lib/underscore/underscore.js:150:9)
at Class._build_onchange_specs (http://localhost:8069/web/static/src/js/views/form_view.js:474:11)
at Class.do_onchange (http://localhost:8069/web/static/src/js/views/form_view.js:525:18)
at Class.<anonymous> (http://localhost:8069/web/static/src/js/views/form_view.js:1213:22)
at Class.trigger (http://localhost:8069/web/static/src/js/framework/mixins.js:222:31)
at Class.trigger (http://localhost:8069/web/static/src/js/framework/mixins.js:272:42)
at Class.<anonymous> (http://localhost:8069/web/static/src/js/views/form_common.js:664:18)

product_view.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
   <data>
 <record id="product_constructor_template_form_view" model="ir.ui.view">
        <field name="name">product.constructor.template.form</field>
        <field name="model">product.template</field>
        <field name="inherit_id" ref="product.product_template_only_form_view"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='type']" position="after">
                <field name="constructor"/>

            </xpath>
        </field>
    </record>

</data>
</openerp>

product.py

from openerp import fields, models,
 _inherit = 'product.template'
constructor = fields.Char(string="Constructeur")
1
Rename the field name constructor to any other name and try again.KbiR
It works thank you very much !Dhouha

1 Answers

2
votes

Rename the field name constructor to any other name and try again.