Skip to Content
Menu
This question has been flagged
1 Reply
2741 Views

xml version="1.0" encoding="utf-8" ?>




id="view_sale_order_inherit_two" model="ir.ui.view">
name="name">sale.order.inherit.two
name="model">sale.order
name="inherit_id" ref="sale.view_order_form"/>
name="arch" type="xml">
name="partner_id" position="after">
name="oc_number"/>






log error:


Erro:
Odoo Server Error

Traceback (most recent call last):
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/tools/convert.py", line 677, in _tag_root
f(rec)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/tools/convert.py", line 580, in _tag_record
record = model._load_records([data], self.mode == 'update')
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/models.py", line 4230, in _load_records
data['record']._load_records_write(data['values'])
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/addons/base/models/ir_ui_view.py", line 1858, in _load_records_write
super(View, self)._load_records_write(values)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/models.py", line 4154, in _load_records_write
self.write(values)
File "/home/corredato/PycharmProjects/rowena14/odoo/addons/website/models/theme_models.py", line 295, in write
res = super(IrUiView, other_views).write(vals)
File "/home/corredato/PycharmProjects/rowena14/odoo/addons/website/models/ir_ui_view.py", line 68, in write
return super(View, self).write(vals)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/addons/base/models/ir_ui_view.py", line 507, in write
res = super(View, self).write(self._compute_defaults(vals))
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/models.py", line 3713, in write
fields[0].determine_inverse(real_recs)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/fields.py", line 1207, in determine_inverse
determine(self.inverse, records)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/fields.py", line 82, in determine
return needle(*args)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/addons/base/models/ir_ui_view.py", line 307, in _inverse_arch
view.write(data)
File "/home/corredato/PycharmProjects/rowena14/odoo/addons/website/models/theme_models.py", line 295, in write
res = super(IrUiView, other_views).write(vals)
File "/home/corredato/PycharmProjects/rowena14/odoo/addons/website/models/ir_ui_view.py", line 68, in write
return super(View, self).write(vals)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/addons/base/models/ir_ui_view.py", line 507, in write
res = super(View, self).write(self._compute_defaults(vals))
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/models.py", line 3703, in write
real_recs._validate_fields(vals, inverse_fields)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/models.py", line 1266, in _validate_fields
check(self)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/addons/base/models/ir_ui_view.py", line 415, in _check_xml
raise ValidationError(_(
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/addons/base/models/ir_ui_view.py", line 398, in _check_xml
view.postprocess_and_fields(view_doc, validate=True)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/addons/base/models/ir_ui_view.py", line 857, in postprocess_and_fields
arch, name_manager = self._postprocess_view(node, model, validate=validate)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/addons/base/models/ir_ui_view.py", line 869, in _postprocess_view
self.postprocess(node, [], editable, name_manager)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/addons/base/models/ir_ui_view.py", line 969, in postprocess
self.postprocess(child, current_node_path, node_info['editable'], name_manager)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/addons/base/models/ir_ui_view.py", line 969, in postprocess
self.postprocess(child, current_node_path, node_info['editable'], name_manager)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/addons/base/models/ir_ui_view.py", line 969, in postprocess
self.postprocess(child, current_node_path, node_info['editable'], name_manager)
[Previous line repeated 1 more time]
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/addons/base/models/ir_ui_view.py", line 948, in postprocess
postprocessor(node, name_manager, node_info)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/addons/base/models/ir_ui_view.py", line 1005, in _postprocess_tag_field
xarch, sub_name_manager = self.with_context(
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/addons/base/models/ir_ui_view.py", line 869, in _postprocess_view
self.postprocess(node, [], editable, name_manager)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/addons/base/models/ir_ui_view.py", line 969, in postprocess
self.postprocess(child, current_node_path, node_info['editable'], name_manager)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/addons/base/models/ir_ui_view.py", line 960, in postprocess
validator(node, name_manager, node_info)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/addons/base/models/ir_ui_view.py", line 1096, in _validate_tag_field
self.handle_view_error(msg)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/addons/base/models/ir_ui_view.py", line 680, in handle_view_error
raise ValueError(formatted_message).with_traceback(from_traceback) from from_exception
odoo.exceptions.ValidationError: Erro ao validar a visualização:

O campo "sequencia" não existe no modelo "sale.order.line"

View name: sale.order.inherit.two
Error context:
view: ir.ui.view(2681,)
xmlid: view_sale_order_inherit_two
view.model: sale.order
view.parent: ir.ui.view(1469,)
file: /home/corredato/PycharmProjects/rowena14/odoo/trustcode-rowena/res_partner_purchase_order/views/sale_po.xml


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/http.py", line 696, in dispatch
result = self._call_function(**self.params)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/http.py", line 370, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/http.py", line 358, in checked_call
result = self.endpoint(*a, **kw)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/http.py", line 919, in __call__
return self.method(*args, **kw)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/http.py", line 544, in response_wrap
response = f(*args, **kw)
File "/home/corredato/PycharmProjects/rowena14/odoo/addons/web/controllers/main.py", line 1374, in call_button
action = self._call_kw(model, method, args, kwargs)
File "/home/corredato/PycharmProjects/rowena14/odoo/addons/web/controllers/main.py", line 1362, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/api.py", line 399, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/api.py", line 386, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "", line 2, in button_immediate_upgrade
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/addons/base/models/ir_module.py", line 74, in check_and_log
return method(self, *args, **kwargs)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/addons/base/models/ir_module.py", line 658, in button_immediate_upgrade
return self._button_immediate_function(type(self).button_upgrade)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/addons/base/models/ir_module.py", line 596, in _button_immediate_function
modules.registry.Registry.new(self._cr.dbname, update_module=True)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/modules/registry.py", line 89, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/modules/loading.py", line 455, in load_modules
processed_modules += load_marked_modules(cr, graph,
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/modules/loading.py", line 347, in load_marked_modules
loaded, processed = load_module_graph(
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/modules/loading.py", line 222, in load_module_graph
load_data(cr, idref, mode, kind='data', package=package)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/modules/loading.py", line 69, in load_data
tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/tools/convert.py", line 733, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/tools/convert.py", line 799, in convert_xml_import
obj.parse(doc.getroot())
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/tools/convert.py", line 719, in parse
self._tag_root(de)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/tools/convert.py", line 677, in _tag_root
f(rec)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/tools/convert.py", line 681, in _tag_root
raise ParseError('while parsing %s:%s, near\n%s' % (
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/http.py", line 652, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/http.py", line 317, in _handle_exception
raise exception.with_traceback(None) from new_cause
odoo.tools.convert.ParseError: while parsing /home/corredato/PycharmProjects/rowena14/odoo/trustcode-rowena/res_partner_purchase_order/views/sale_po.xml:6, near

sale.order.inherit.two
sale.order


Traceback (most recent call last):
  File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/http.py", line 652, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/http.py", line 317, in _handle_exception
    raise exception.with_traceback(None) from new_cause
odoo.tools.convert.ParseError: while parsing /home/corredato/PycharmProjects/rowena14/odoo/trustcode-rowena/res_partner_purchase_order/views/sale_po.xml:6, near

            sale.order.inherit.two
            sale.order
            
            
                
                    
                
            
        









Avatar
Discard
Author

Hi Cybrosys, thanks for your answer, but still does'nt work, can you see the final of the log?


Traceback (most recent call last):
  File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/http.py", line 652, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/corredato/PycharmProjects/rowena14/odoo/odoo/http.py", line 317, in _handle_exception
    raise exception.with_traceback(None) from new_cause
odoo.tools.convert.ParseError: while parsing /home/corredato/PycharmProjects/rowena14/odoo/trustcode-rowena/res_partner_purchase_order/views/sale_po.xml:6, near

            sale.order.inherit.two
            sale.order
            
            
                
                    
                
            
        


Best Answer

Hi, 

Try this code.

<record id="view_sale_order_inherit_two" model="ir.ui.view">


    <field name="name">sale.order.inherit.two</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='partner_id']" position="after">


            <field name="oc_number"/>


        </xpath>


    </field>


</record>


The code introduces changes to the initial code block by adding an `<xpath>` tag within the `<field name="arch" type="xml">` block. This allows for more precise targeting of elements in the XML structure. The XPath expression `//field[@name='partner_id']` is used to locate the "partner_id" field, and the `position="after"` attribute ensures that the new "oc_number" field is inserted after it. This modification enhances the code's flexibility, enabling the addition of the "oc_number" field in the desired position relative to the "partner_id" field within the inherited view.


Regards

Avatar
Discard
Related Posts Replies Views Activity
1
May 23
1747
4
Oct 20
7798
0
Mar 15
3246
3
Feb 24
9401
1
Nov 23
1738