Я создал пользовательский модуль для добавления конструктора поля в шаблон продукта. Я использую odoo 9. Мое поле было добавлено в виде, но когда я хочу изменить старый продукт или создать новый, он показывает эту ошибку. Любая помощь, пожалуйста?
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")