Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
5069 Visualizzazioni

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
Abbandona

Hello Omar,

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

Thanks & regards

Ankit Vaghela

Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
3
set 24
1892
3
mag 25
678
1
apr 23
1748
2
mar 23
3305
3
ott 24
6053