Odoo Help


Change invoice.line

Manfred Pürro
on 9/18/15, 5:24 AM 1,012 views

By default Odoo adds Product-Title and Product-Description to the Invoice order.line Description.

I would like to have it slightly different:

Product Title (aka name) Product-Variants (p.ex. red, size L and so on...)

Nike Shirt (Red, XL)

How do i do that? I found a module that comes close, but somehow i'm Stuck! https://www.odoo.com/apps/modules/8.0/account_invoice_line_description/

Here is the relevant code from the module i found - It adds only the Product Description to the order.line.description --> So changing that to product title and Variants should not be that hard... should... i need help.

class AccountInvoiceLine(models.Model):
_inherit = "account.invoice.line"

def product_id_change(
self, product, uom_id, qty=0, name='', type='out_invoice',
partner_id=False, fposition_id=False, price_unit=False,
currency_id=False, company_id=None
res = super(AccountInvoiceLine, self).product_id_change(
product, uom_id, qty=qty,
name=name, type=type, partner_id=partner_id,
fposition_id=fposition_id, price_unit=price_unit,
currency_id=currency_id, company_id=company_id
if product:
if self.user_has_groups(
product = self.env['product.product'].browse(product)
if product.description:
if 'value' not in res:
res['value'] = {}
res['value']['name'] = product.description
return res

Thank you very much!

Hello Manfred, Do you want this to apply only for account.invoice.line or to other lines such as sale.order.line stock.move etc? I'm asking because the solution differs depending on the needs Regards, Paul

Paul Catinean
on 9/18/15, 9:52 AM

Hello Paul At the time i only need it for account.invoice.line If it is substantially easier to do it globally - that would be ok to. At the moment we only use a very small part of odoo.. Thanks a lot for any Tipps!. (Unfortunately i can't comment directly on your Answer Paul - due to karma points)

Manfred Pürro
on 9/18/15, 10:34 AM
Manfred Pürro
On 9/25/15, 9:52 AM

Thanks for the Tipps! For the moment we circumvent that one. I'll post my solution as soon as i got one...




| 4 4 6
Hyderabad, India

On 9/21/15, 3:46 AM

Hi Manfred,

If you need it to be done only for account invoice line particularly then you have to:

1) pass context in product field in account invoice line object

2) override product.product's name_get() method

3) call its name_get() super method and store the result in a variable

3) if that passed context is found in name_get()'s context, then modify the string part of the result: [(1[id], 'LAPTOP'[string]), ()]
 else return the super's result as it is:

Or, if you want to apply it every where then

1) add a new char field to store your modified string to product.product

2) populate this field at the time of creating the product

3) update _rec_name with this field: _rec_name: YOUR_NEW_FIELD,

Hope it will help you...


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: 9/18/15, 5:24 AM
Seen: 1012 times
Last updated: 9/25/15, 9:52 AM