Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to add a new column in purchase order

By
Senthil Kumar
on 1/6/16, 11:47 PM 299 views

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

2

Jignesh Mehta

--Jignesh Mehta--
2081
| 6 4 8
Surat, India
--Jignesh Mehta--


Jignesh Mehta
On 1/7/16, 3:09 AM

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,

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/6/16, 11:47 PM
Seen: 299 times
Last updated: 1/7/16, 3:09 AM