Hi,
I need to create a new column in Purchase order invoice line and Purchase order invoice header. I have inherited the class in both xml and python but it doesn't added.
My Code..
In Python:
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
my_field= fields.Float(string='My Field', readonly=True)
class AccountInvoiceLine(models.Model):
""" Override AccountInvoice_line to add the link to the purchase order line
it is related to"""
_inherit = 'account.invoice.line'
_my_field_1= fields.Many2many('example.table', string='My Field 1')
In XML:
<record id="view_invoice_line_form_inherit" model="ir.ui.view">
<field name="name">account.invoice.line.form.inherit</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.view_invoice_line_form"/>
<field name="arch" type="xml">
<xpath expr="/form/sheet/notebook/page[1]/field[@name='order_line']/tree//field[@name='discount']"
position="after">
<field name="_my_field_1" widget="many2many_tags"/>
</xpath>
<xpath expr="/field[@name='amount_tax']"
position="after">
<field name="my_field"/>
</xpath>
</field>
</record>
So can anyone tell me how to add a custom fields into the Purchase Order invoice