Hi,
i'm working to customize the page of "Sale Order".
I need to hide a field: this have as code "template_id".
I use this code to replace the field
<record model="ir.ui.view" id="sale_mod2_view_order_form"> <field name="name">sale.order.form.inherit</field> <field name="model">sale.order</field> <field name="inherit_id" ref="sale.view_order_form" /> <field name="arch" type="xml"> <xpath expr="//field[@name='x_TIPO_ORDINE_IQ']" position="before"> <field name="mandante"/> </xpath> <xpath expr="//field[@name='pricelist_id']" position="replace"> </xpath> <xpath expr="//field[@name='template_id']" position="replace"> </xpath> </field> </record>
When i Install the app, i recevice the follow error :
2017-08-02 17:10:29,566 12844 INFO sm_pro openerp.modules.loading: 1 modules loaded in 0.02s, 0 queries 2017-08-02 17:10:30,303 12844 INFO sm_pro openerp.modules.loading: loading 128 modules... 2017-08-02 17:10:33,224 12844 INFO sm_pro openerp.modules.module: module ordini_lavorazione: creating or updating database tables 2017-08-02 17:10:33,344 12844 INFO sm_pro openerp.modules.loading: loading ordini_lavorazione/views/ordine_spedizione.xml 2017-08-02 17:10:33,457 12844 ERROR sm_pro openerp.addons.base.ir.ir_ui_view: L'elemento '<xpath expr="//field[@name='template_id']">' non può esser localizzato nella vista genitore Error context: View `sale.order.form.inherit` [view_id: 1893, xml_id: ordini_lavorazione.sale_mod2_view_order_form, model: sale.order, parent_id: 648] 2017-08-02 17:10:33,459 12844 ERROR sm_pro openerp.http: Exception during JSON request handling. Traceback (most recent call last): File "/opt/odoo/openerp/http.py", line 539, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/opt/odoo/openerp/http.py", line 576, in dispatch result = self._call_function(**self.params) File "/opt/odoo/openerp/http.py", line 312, in _call_function return checked_call(self.db, *args, **kwargs) File "/opt/odoo/openerp/service/model.py", line 118, in wrapper return f(dbname, *args, **kwargs) File "/opt/odoo/openerp/http.py", line 309, in checked_call return self.endpoint(*a, **kw) File "/opt/odoo/openerp/http.py", line 805, in __call__ return self.method(*args, **kw) File "/opt/odoo/openerp/http.py", line 405, in response_wrap response = f(*args, **kw) File "/usr/lib/python2.7/site-packages/odoo-8.0.post20160413-py2.7.egg/openerp/addons/web/controllers/main.py", line 948, in call_button action = self._call_kw(model, method, args, {}) File "/usr/lib/python2.7/site-packages/odoo-8.0.post20160413-py2.7.egg/openerp/addons/web/controllers/main.py", line 936, in _call_kw return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs) File "/opt/odoo/openerp/api.py", line 268, in wrapper return old_api(self, *args, **kwargs) File "/usr/lib/python2.7/site-packages/odoo-8.0.post20160413-py2.7.egg/openerp/addons/base/module/module.py", line 534, in button_immediate_upgrade return self._button_immediate_function(cr, uid, ids, self.button_upgrade, context=context) File "/opt/odoo/openerp/api.py", line 268, in wrapper return old_api(self, *args, **kwargs) File "/usr/lib/python2.7/site-packages/odoo-8.0.post20160413-py2.7.egg/openerp/addons/base/module/module.py", line 495, in _button_immediate_function registry = openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True) File "/opt/odoo/openerp/modules/registry.py", line 370, in new openerp.modules.load_modules(registry._db, force_demo, status, update_module) File "/opt/odoo/openerp/modules/loading.py", line 351, in load_modules force, status, report, loaded_modules, update_module) File "/opt/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 "/opt/odoo/openerp/modules/loading.py", line 176, in load_module_graph _load_data(cr, module_name, idref, mode, kind='data') File "/opt/odoo/openerp/modules/loading.py", line 118, in _load_data tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report) File "/opt/odoo/openerp/tools/convert.py", line 900, in convert_file convert_xml_import(cr, module, fp, idref, mode, noupdate, report) File "/opt/odoo/openerp/tools/convert.py", line 986, in convert_xml_import obj.parse(doc.getroot(), mode=mode) File "/opt/odoo/openerp/tools/convert.py", line 852, in parse self._tags[rec.tag](self.cr, rec, n, mode=mode) File "/opt/odoo/openerp/tools/convert.py", line 762, 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 "/opt/odoo/openerp/api.py", line 268, in wrapper return old_api(self, *args, **kwargs) File "/usr/lib/python2.7/site-packages/odoo-8.0.post20160413-py2.7.egg/openerp/addons/base/ir/ir_model.py", line 1019, in _update model_obj.write(cr, uid, [res_id], values, context=context) File "/opt/odoo/openerp/api.py", line 268, in wrapper return old_api(self, *args, **kwargs) File "/usr/lib/python2.7/site-packages/odoo-8.0.post20160413-py2.7.egg/openerp/addons/base/ir/ir_ui_view.py", line 273, in write context) File "/opt/odoo/openerp/api.py", line 268, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/openerp/api.py", line 399, in old_api result = method(recs, *args, **kwargs) File "/opt/odoo/openerp/models.py", line 3788, in write self._write(old_vals) File "/opt/odoo/openerp/api.py", line 266, in wrapper return new_api(self, *args, **kwargs) File "/opt/odoo/openerp/api.py", line 592, in new_api result = method(self._model, cr, uid, self.ids, *args, **old_kwargs) File "/opt/odoo/openerp/models.py", line 3960, in _write recs._validate_fields(vals) File "/opt/odoo/openerp/api.py", line 266, in wrapper return new_api(self, *args, **kwargs) File "/opt/odoo/openerp/models.py", line 1271, in _validate_fields raise ValidationError('\n'.join(errors)) ParseError: "ValidateError Field(s) `arch` failed against a constraint: Invalid view definition Dettagli dell'Errore: L'elemento '<xpath expr="//field[@name='template_id']">' non può esser localizzato nella vista genitore Error context: View `sale.order.form.inherit` [view_id: 1893, xml_id: ordini_lavorazione.sale_mod2_view_order_form, model: sale.order, parent_id: 648]" while parsing /home/odoo/custom/addons/ordini_lavorazione/views/ordine_spedizione.xml:32, near <record model="ir.ui.view" id="sale_mod2_view_order_form"> <field name="name">sale.order.form.inherit</field> <field name="model">sale.order</field> <field name="inherit_id" ref="sale.view_order_form"/> <field name="arch" type="xml"> <data><xpath expr="//field[@name='x_TIPO_ORDINE_IQ']" position="before"> <field name="mandante"/> </xpath> <xpath expr="//field[@name='pricelist_id']" position="replace"> </xpath> <xpath expr="//field[@name='template_id']" position="replace"> </xpath> </data></field> </record> 2017-08-02 17:10:33,470 12844 INFO sm_pro werkzeug: 127.0.0.1 - - [02/Aug/2017 17:10:33] "POST /web/dataset/call_button HTTP/1.1" 200 -
Anyone help me ?