Skip to Content
Menu
This question has been flagged
2 Replies
3796 Views

Hello everyone, I am trying to add 2 fields in sale order lines, but when I am adding the values ​​in the tree view of it by using the view inheritance method, the change is not reflecting, can someone please guide me on this issue.

Following is my code and the changes are not reflecting in Sale->Order (Tree view on that page)

<record id = "sale_order_view_inherit" model = "ir.ui.view" > 
<field name = "name" > sale.order.view.inherit1 </ field >
<field name = "model" > sale.order.line < / field >
<field name = "inherit_id" ref = "sale_stock.view_order_line_tree_inherit_sale_stock" />
<field name = "arch" type = "xml" >
<field name = "price_unit" position= "after" >
< field name = "trade_offer" />
</field >
</field >
</record>


I want to add a field after price_unit field in the tree view of Sale->order tree view

Avatar
Discard

Hello Omar,

can you paste your code here for better understanding of issue/error?

Thanks & regards

Ankit Vaghela

Best Answer

Hi,

Inherit the sale.order.line model and add the new field and in the xml, you can xpath and add fields to the order line like this,

<record id="sale_order_view_inherit" model="ir.ui.view">
<field name="name">sale.order.view.inherit1</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="/form/sheet/notebook/page/field[@name='order_line']/tree/field[@name='name']" position="after">
<field name="new_field"/>
</xpath>
</field>
</record>

Reference:  How To Inherit And Add Field to Existing Views In Odoo

Thanks

Avatar
Discard
Related Posts Replies Views Activity
3
Sep 24
238
1
Apr 23
897
2
Mar 23
2364
3
Oct 24
4752
1
Feb 21
1658