Odoo Help


how to inherit or replace the product object in the customer invoicing form?

Hachem Chraiti
on 4/18/14, 7:20 PM 1,898 views

hi, how to replace the product object in the customet.r invoice? i can not inherit from the product.product it show an error!!

ProgrammingError: column product_product.name does not exist LINE 1: SELECT product_product."name",product_product."price",produc...

What do you want do exactly.

Jagdish Panchal
on 4/19/14, 2:06 AM

i want to replace products in the customer invoices by another object,so i try to inherit from the product,any other solution pleasE?

Hachem Chraiti
on 4/19/14, 5:24 AM

i have added ans check it

Jagdish Panchal
on 4/19/14, 5:45 AM

Jagdish Panchal

--Jagdish Panchal--

| 5 4 6
Gandhinagar, India
--Jagdish Panchal--

OpenERP Developer

Jagdish Panchal
On 4/19/14, 5:41 AM


Try below code

Add in .py file

class account_invoice_line(osv.osv):
    _inherit = "account.invoice.line"
    _columns = {
            'your_new_field': fields.many2one('your object name', 'Field name',),

Add in .xml file

<record id="invoice_customer_invoice_form" model="ir.ui.view">
    <field name="name">account.invoice.customer.form.test</field>
    <field name="model">account.invoice</field>
    <field name="inherit_id" ref="account.invoice_form"/>
    <field name="arch" type="xml">
            <xpath expr="/form/sheet/notebook/page/field[@name='invoice_line']/tree/field[@name='product_id']" position="replace">
                <field name="product_id" on_change="product_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.currency_id, context, parent.company_id)" invisible="1"/>

            <xpath expr="/form/sheet/notebook/page/field[@name='invoice_line']/tree/field[@name='name']" position="before">
                <field name="your_new_field"/>


thaaaanks for it,but how to modify the fields like(amount,unit price,deciprtion) dynamically from my new object??

Hachem Chraiti
on 4/19/14, 6:17 AM

Use oncange_method like product oncange_method in account_invoice.py

Jagdish Panchal
on 4/19/14, 6:40 AM

an example please?how to dynamically change the amount ?

Hachem Chraiti
on 4/19/14, 6:56 AM

Refer account >> account_invoice.py file in this file there is one method product_id_change this method will help you and also check account_invoice_view.xml line no 51 if you problem is solve than give vote to answer

Jagdish Panchal
on 4/19/14, 7:10 AM

well done thanks soo much sur :)))

Hachem Chraiti
on 4/19/14, 1:13 PM

pleaase how can i load the invoice line automaticaaly :when i choose the customer it will load all invoice lines in relation with the chosen customer????

Hachem Chraiti
on 4/22/14, 4:39 PM

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 4/18/14, 7:20 PM
Seen: 1898 times
Last updated: 3/16/15, 8:10 AM