コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
5090 ビュー

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

アバター
破棄

Hello Omar,

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

Thanks & regards

Ankit Vaghela

最善の回答

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

アバター
破棄
関連投稿 返信 ビュー 活動
3
9月 24
1899
3
5月 25
687
1
4月 23
1752
2
3月 23
3313
3
10月 24
6055