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 inherit or replace the product object in the customer invoicing form?

By
Hachem Chraiti
on 4/18/14, 7:20 PM 1,314 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
1

Jagdish Panchal

--Jagdish Panchal--
2674
| 5 3 6
Gandhinagar, India
--Jagdish Panchal--

OpenERP Developer

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

Hi,

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',),
            }
account_invoice_line()

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>

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

    </field>
</record>

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

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: 4/18/14, 7:20 PM
Seen: 1314 times
Last updated: 3/16/15, 8:10 AM