跳至内容
菜单
此问题已终结
2 回复
5070 查看

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
1893
3
5月 25
681
1
4月 23
1749
2
3月 23
3305
3
10月 24
6054