I have been coding the reading for the last 3 days trying to find out what I am missing.
All I want to do is to add a config setting to the sale settings. The issue is that when I override the xml of setting page, Odoo cannot find the field.
Here is the error that I get:
15-05-26 21:56:21,290 30095 INFO samy openerp.modules.loading: loading odootec_wh_count/odootec_res_config_view.xml 2015-05-26 21:56:21,321 30095 ERROR samy openerp.addons.base.ir.ir_ui_view: Field `group_qty_warning_on_selected_wh` does not exist Error context: View `sale settings` [view_id: 716, xml_id: odootec_wh_count.odootec_view_sale_config, model: sale.config.settings, parent_id: 698] 2015-05-26 21:56:21,324 30095 INFO samy werkzeug: 127.0.0.1 - - [26/May/2015 21:56:21] "GET / HTTP/1.1" 500 - 2015-05-26 21:56:21,338 30095 ERROR samy werkzeug: Error on request: Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 177, in run_wsgi execute(self.server.app) File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 165, in execute application_iter = app(environ, start_response) File "/home/hesham/odoo/openerp/service/server.py", line 285, in app return self.app(e, s) File "/home/hesham/odoo/openerp/service/wsgi_server.py", line 216, in application return application_unproxied(environ, start_response) File "/home/hesham/odoo/openerp/service/wsgi_server.py", line 202, in application_unproxied result = handler(environ, start_response) File "/home/hesham/odoo/openerp/http.py", line 1290, in __call__ return self.dispatch(environ, start_response) File "/home/hesham/odoo/openerp/http.py", line 1264, in __call__ return self.app(environ, start_wrapped) File "/usr/local/lib/python2.7/dist-packages/werkzeug/wsgi.py", line 588, in __call__ return self.app(environ, start_response) File "/home/hesham/odoo/openerp/http.py", line 1426, in dispatch ir_http = request.registry['ir.http'] File "/home/hesham/odoo/openerp/http.py", line 345, in registry return openerp.modules.registry.RegistryManager.get(self.db) if self.db else None File "/home/hesham/odoo/openerp/modules/registry.py", line 339, in get update_module) File "/home/hesham/odoo/openerp/modules/registry.py", line 370, in new openerp.modules.load_modules(registry._db, force_demo, status, update_module) File "/home/hesham/odoo/openerp/modules/loading.py", line 351, in load_modules force, status, report, loaded_modules, update_module) File "/home/hesham/odoo/openerp/modules/loading.py", line 255, in load_marked_modules loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks) File "/home/hesham/odoo/openerp/modules/loading.py", line 176, in load_module_graph _load_data(cr, module_name, idref, mode, kind='data') File "/home/hesham/odoo/openerp/modules/loading.py", line 118, in _load_data tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report) File "/home/hesham/odoo/openerp/tools/convert.py", line 901, in convert_file convert_xml_import(cr, module, fp, idref, mode, noupdate, report) File "/home/hesham/odoo/openerp/tools/convert.py", line 987, in convert_xml_import obj.parse(doc.getroot(), mode=mode) File "/home/hesham/odoo/openerp/tools/convert.py", line 853, in parse self._tags[rec.tag](self.cr, rec, n, mode=mode) File "/home/hesham/odoo/openerp/tools/convert.py", line 763, 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/hesham/odoo/openerp/api.py", line 241, in wrapper return old_api(self, *args, **kwargs) File "/home/hesham/odoo/openerp/addons/base/ir/ir_model.py", line 1050, in _update model_obj.write(cr, uid, [res_id], values, context=context) File "/home/hesham/odoo/openerp/api.py", line 241, in wrapper return old_api(self, *args, **kwargs) File "/home/hesham/odoo/openerp/addons/base/ir/ir_ui_view.py", line 282, in write context) File "/home/hesham/odoo/openerp/api.py", line 241, in wrapper return old_api(self, *args, **kwargs) File "/home/hesham/odoo/openerp/api.py", line 363, in old_api result = method(recs, *args, **kwargs) File "/home/hesham/odoo/openerp/models.py", line 3774, in write self._write(old_vals) File "/home/hesham/odoo/openerp/api.py", line 239, in wrapper return new_api(self, *args, **kwargs) File "/home/hesham/odoo/openerp/api.py", line 546, in new_api result = method(self._model, cr, uid, self.ids, *args, **kwargs) File "/home/hesham/odoo/openerp/models.py", line 3945, in _write recs._validate_fields(vals) File "/home/hesham/odoo/openerp/api.py", line 239, in wrapper return new_api(self, *args, **kwargs) File "/home/hesham/odoo/openerp/models.py", line 1270, in _validate_fields raise ValidationError('\n'.join(errors)) ParseError: "ValidateError Field(s) `arch` failed against a constraint: Invalid view definition Error details: Field `group_qty_warning_on_selected_wh` does not exist Error context: View `sale settings` [view_id: 716, xml_id: odootec_wh_count.odootec_view_sale_config, model: sale.config.settings, parent_id: 698]" while parsing /home/hesham/odootec-projects/odootec-repo/odootec_wh_count/odootec_res_config_view.xml:4, near <record id="odootec_view_sale_config" model="ir.ui.view"> <field name="name">sale settings</field> <field name="model">sale.config.settings</field> <field name="inherit_id" ref="sale.view_sales_config"/> <!--<field name="priority" eval="16"/>--> <field name="arch" type="xml"> <xpath expr="//div[@name='warehouse_features']" position="inside"> <div> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX <field name="group_qty_warning_on_selected_wh" class="oe_inline"/> <label for="group_qty_warning_on_selected_wh"/> </div> </xpath> </field> </record>
from openerp import fields, models, _
class sale_quote_settings(models.TransientModel):
_name = 'sale_quote.config.settings'
_inherit = 'sale.config.settings'
group_qty_warning_on_selected_wh = fields.Boolean(_('Qty warning on selected warehouse'),
group="", implied_group="",
required=True, default=True,
help=_("To restrict product count to the stock location of selected warehouse only, when making a quotation"))
and the res_config_view.xml file:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="odootec_view_sale_config" model="ir.ui.view">
<field name="name">sale settings</field>
<field name="model">sale.config.settings</field>
<field name="inherit_id" ref="sale.view_sales_config"/>
<!--<field name="priority" eval="16"/>-->
<field name="arch" type="xml">
<xpath expr="//div[@name='warehouse_features']" position="inside">
<div>
<field name="group_qty_warning_on_selected_wh" class="oe_inline"/>
<label for="group_qty_warning_on_selected_wh"/>
</div>
</xpath>
</field>
</record>
</data>
</openerp>
What am I missing?