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

I need add field and operation in purchase lines puth inerith dont work for purschase.order.line  

Avatar
Discard
Best Answer

Hi,

For adding a new field in purchase order line, try the below code

in python

class PurchaseOrderLine(models.Model):
_inherit = 'purchase.order.line'
your_custom_field = fields.Char(string="Custom Field")

in XML

<record id="purchase_order_form_inherit" model="ir.ui.view">
<field name="name">purchase.order.form.inherit</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='order_line']/tree/field[@name='field_name']" position="after">
<field name="your_custom_field"/>
</xpath>
</field>
</record>

Regards

Avatar
Discard
Author

thanks for your answer

it is very useful

Author

thanks for your answer

it is very useful

Best Answer

What you have done so far?

Avatar
Discard
Related Posts Replies Views Activity
0
Dec 24
26
1
Dec 24
38
0
Nov 24
29
1
Nov 24
216
0
Nov 24
63