This question has been flagged
1 Reply
4427 Views

Can anyone please let me know how to add a new column in Purchase Order in products tab in v8

Avatar
Discard
Best Answer

Hello Senthil,


Inherit product.product and add field which you want to add.

then inherit the view of purchase order form which is purchase_order_form and then in the tree view of order_line field add your field.


Ex :-

In Py:-

class product.product(models.Model)

     _inherit = 'product.product'

     custom_field = fields.Float('Field Name')


In Xml:-

<record id="inherit_purchase_order_form_view" model="ir.ui.view">

    <field name="name">inherit.purchase.order.form.view</field>

    <field name="model">purchase.order</field>

    <field name="inherit_id" ref="purchase.purchase_order_form"/>

    <field name="arch" type="xml">

        <xpath expr="/form/sheet/notebook/page[1]/field[@name='order_line']/tree/field[@name='name']" position="after">

            <field name="custom_field"/>

         </xpath>

     </field>

</record>



Hope it works for you.

Thanks,

Avatar
Discard