Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
5089 Zobrazení

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
Zrušit

Hello Omar,

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

Thanks & regards

Ankit Vaghela

Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
3
zář 24
1898
3
kvě 25
687
1
dub 23
1751
2
bře 23
3313
3
říj 24
6055