Odoo Help


Need help of OpenERP Developer to extend account.invoice.line

on 1/12/14, 9:38 AM 1,728 views

Inside model account.invoice.line, there is only available line.name, which joins product_id, product name and product description. These fields can not be accessed separately so far. I only want to display product.name_template at printed invoices. Product_ID and description should only be for internal purposes.

Could anybody give me any example code? I am familiar with developing, but unfortunately not with python and I do not have any practical experience with ORM either. I have already inherited some classes to add some custom fields, but up to now, I have never stepped over the horizon of the data model I want to extend. In this case, account.invoice.line "knows" her product_id, but I have no idea how to get from this to my desired field.

For example, I saw code like that:

self.pool.get('product_product').browse(cr, uid, id).name_template

Is this sufficient to fetch all name_templates for every invoice.line and then store it to the table? To see some code related to my problem in entire context would be very helpful to me...

Many views, but no answer so far... My question is rather a general one about data access within ORM models - maybe it is not described clear enough - so I will try once again:

If the data model I want to extend contains a column with the ids of another object I want to add additional fields from, how do I access these fields from the foreign model? Do I need to browse for this object's model/table first or do I get the information needed by simply calling <id>.<field_I_need>?

on 1/20/14, 6:07 AM

For my special case this means: I want to add further information from product.product to account.invoice.line model. The latter already contains a column with product.product.id - this means a relation to the model/table I want to add additional fields from is already there. But how to access fields of this foreign model from within python code now?

on 1/20/14, 6:08 AM

Now, I can answer this question myself: I the relation to another table is already there, from within python code, there is no need to browse for a special field of this table. Every field can simply be accessed by going over this foreign ID. For example for accessing product_product.name_template from account.invoice.line one has to do this: l.product_id.name_template.

on 2/8/14, 9:15 AM

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

0 follower(s)


Asked: 1/12/14, 9:38 AM
Seen: 1728 times
Last updated: 3/16/15, 8:10 AM