I am using odoo 9 and ran into this error when trying to display a field "my_lot_id" in a view that I inherit from stock.view_picking_form. Please help.
2016-09-07 09:11:15,662 14882 INFO ? openerp: OpenERP version 9.0c
2016-09-07 09:11:15,663 14882 INFO ? openerp: addons paths: ['/home/simonlee/.local/share/Odoo/addons/9.0', u'/home/simonlee/odoo/addons', u'/home/simonlee/odoo/customaddons', '/home/simonlee/odoo/openerp/addons']
2016-09-07 09:11:15,663 14882 INFO ? openerp: database: default@default:default
2016-09-07 09:11:15,975 14882 INFO ? openerp.service.server: HTTP service (werkzeug) running on 0.0.0.0:8069
2016-09-07 09:11:16,037 14882 INFO hago openerp.modules.loading: loading 1 modules...
2016-09-07 09:11:16,071 14882 INFO hago openerp.modules.loading: 1 modules loaded in 0.03s, 0 queries
2016-09-07 09:11:16,447 14882 INFO hago openerp.modules.loading: loading 44 modules...
2016-09-07 09:11:16,475 14882 INFO ? openerp.addons.bus.models.bus: Bus.loop listen imbus on db postgres
2016-09-07 09:11:16,547 14882 INFO hago openerp.addons.report.models.report: Will use the Wkhtmltopdf binary at /usr/local/bin/wkhtmltopdf
2016-09-07 09:11:18,034 14882 INFO hago openerp.modules.module: module hago: creating or updating database tables
2016-09-07 09:11:19,364 14882 INFO hago openerp.modules.loading: loading hago/views/hago_view.xml
2016-09-07 09:11:19,428 14882 INFO ? openerp.http: HTTP Configuring static files
2016-09-07 09:11:19,996 14882 INFO hago openerp.addons.base.ir.ir_ui_view: Field `my_lot_id` does not exist
Error context:
View `hago.picking.form.inherit`
[view_id: 731, xml_id: hago.view_picking_form_inherit, model: stock.picking, parent_id: 579]
2016-09-07 09:11:19,998 14882 ERROR hago openerp.modules.registry: Failed to load registry
Traceback (most recent call last):
File "/home/simonlee/odoo/openerp/modules/registry.py", line 386, in new
openerp.modules.load_modules(registry._db, force_demo, status, update_module)
File "/home/simonlee/odoo/openerp/modules/loading.py", line 334, in load_modules
force, status, report, loaded_modules, update_module)
File "/home/simonlee/odoo/openerp/modules/loading.py", line 237, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "/home/simonlee/odoo/openerp/modules/loading.py", line 156, in load_module_graph
_load_data(cr, module_name, idref, mode, kind='data')
File "/home/simonlee/odoo/openerp/modules/loading.py", line 98, in _load_data
tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
File "/home/simonlee/odoo/openerp/tools/convert.py", line 851, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
File "/home/simonlee/odoo/openerp/tools/convert.py", line 938, in convert_xml_import
obj.parse(doc.getroot(), mode=mode)
File "/home/simonlee/odoo/openerp/tools/convert.py", line 801, in parse
self.parse(rec, mode)
File "/home/simonlee/odoo/openerp/tools/convert.py", line 804, in parse
self._tags[rec.tag](self.cr, rec, de, mode=mode)
File "/home/simonlee/odoo/openerp/tools/convert.py", line 708, in _tag_record
id = self.pool['ir.model.data']._update(cr, self.uid, rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode, context=rec_context )
File "/home/simonlee/odoo/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/home/simonlee/odoo/openerp/addons/base/ir/ir_model.py", line 1097, in _update
model_obj.write(cr, uid, [res_id], values, context=context)
File "/home/simonlee/odoo/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/home/simonlee/odoo/openerp/addons/base/ir/ir_ui_view.py", line 376, in write
context)
File "/home/simonlee/odoo/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/home/simonlee/odoo/openerp/api.py", line 381, in old_api
result = method(recs, *args, **kwargs)
File "/home/simonlee/odoo/openerp/models.py", line 3837, in write
self._write(old_vals)
File "/home/simonlee/odoo/openerp/api.py", line 248, in wrapper
return new_api(self, *args, **kwargs)
File "/home/simonlee/odoo/openerp/api.py", line 574, in new_api
result = method(self._model, cr, uid, self.ids, *args, **old_kwargs)
File "/home/simonlee/odoo/openerp/models.py", line 4024, in _write
recs._validate_fields(vals)
File "/home/simonlee/odoo/openerp/api.py", line 248, in wrapper
return new_api(self, *args, **kwargs)
File "/home/simonlee/odoo/openerp/models.py", line 1271, in _validate_fields
raise ValidationError('\n'.join(errors))
ParseError: "Invalid view definition
Error details:
Field `my_lot_id` does not exist
Error context:
View `hago.picking.form.inherit`
[view_id: 731, xml_id: hago.view_picking_form_inherit, model: stock.picking, parent_id: 579]
None" while parsing /home/simonlee/odoo/customaddons/hago/views/hago_view.xml:68, near
<record id="view_picking_form_inherit" model="ir.ui.view">
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="model">stock.picking</field>
<field name="arch" type="xml">
<data><xpath expr="//field[@name='product_id']" position="after">
<field name="my_lot_id"/>
</xpath>
<xpath expr="//field[@name='qty_done']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
</data></field>
</record>
2016-09-07 09:11:20,006 14882 INFO hago openerp.modules.loading: loading 1 modules...
2016-09-07 09:11:20,009 14882 CRITICAL hago openerp.service.server: Failed to initialize database `hago`.
Here's the view code (views/hago_view.xml):
<!-- ================================================= -->
<!-- File: addons/stock/stock_view.xml -->
<!-- Form: view_picking_form -->
<!-- ================================================= -->
<record id="view_picking_form_inherit" model="ir.ui.view">
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="model">stock.picking</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='product_id']" position="after">
<field name="my_lot_id"/>
</xpath>
</field>
</record>
Here's the module code (hago.py):
class hago_stock_picking(models.Model):
_inherit = 'stock.picking'
my_lot_id = fields.Many2one('stock.production.lot', string='Serial No')
Here's the __init__.py
# -*- coding:utf-8 -*-
from models import hago
Here's the __openerp__.py
{
'name': 'hago',
'version': '1.0',
'description':'Module Hago',
'author': "Simon Lee",
'depends': ['purchase'],
'data': ['views/hago_view.xml', 'reports/hago_report.xml'],
'installable': True,
'application': True,
}