Odoo Help


3 Answers

Prakash India


| 6 7 9
Bikaner, India

OpenERP Developer at SunARC Technology

Prakash India
5/6/14, 7:20 PM

just modify your comment typed code type='char' into type='many2one' Example, 'manufacturer':fields.related('product_id', 'manufacturer', type='many2one', relation='product.product', string='manufacturer', store=True); same as sudhir arya but change relation res.partner into product.product.

Stone Indonesia
5/6/14, 11:09 PM

hi, the problem u had is caused by "relation", the field u created on product_product is many2one and the object is res.partner. So on field related in purchase.order.line, u need to link it to res.partner instead of product.product

please try this code : 'manufacturer_pref': fields.related('product_id', 'manufacturer', type="many2one", relation="res.partner", string="Manufacturer Code", store=True),

Christian Parent Canada
5/7/14, 11:27 AM

Yes. finaly, Maybe we had tried this earlier but I had a typos in, fields.related('product_id', 'manufacturer', type="many2one", relation="res.partner", string="Manufacturier", store=True),


Sudhir Arya (ERP Harbor Consulting Services) India

--Sudhir Arya (ERP Harbor Consulting Services)--
| 8 9 10
Ahmedabad, India
--Sudhir Arya (ERP Harbor Consulting Services)--

• Co-Founder & Co-Owner at ERP Harbor Consulting Services

• ERP Consultant / ERP Customization / TechnoFunctional Expert

• Sound knowledge in Python, Odoo (Open ERP), XML, PostgreSQL

• Domain knowledge of Sale Management, Purchase Management, Warehouse Management, Manufacturing, Multi Company Configuration & Management, HR Management, Medical Management, Construction Management, Education Management, Point of Sale, Third Party Integrations

• Positive attitude and quick Learner

• Good analytical skill, quick bug and issue tracing and find the solution

• Good knowledge and experience in payment gateway integration with Odoo

• Ready to accept new challenges

• Active Memeber On Stackoverflow 




ERP Harbor Consulting Services

Website: http://www.erpharbor.com
Sudhir Arya (ERP Harbor Consulting Services) India
4/28/14, 1:25 PM

Hello Christian Parent,

You just have to add another related field to get manufacturer.

Here it is:

fields.related('product_id', 'manufacturer', relation='res.partner', type='many2one', string='Manufacturer')

You can get more information about related and other fields: OpenERP Fields

Hope this will help you.

Christian Parent Canada
4/30/14, 1:29 PM

I am receiving File "/opt/openerp/server/openerp/osv/fields.py", line 1285, in _fnct_read value = value[field] or False File "/opt/openerp/server/openerp/osv/orm.py", line 387, in __getitem__ raise KeyError(error_msg) KeyError: "Field 'manufacturer' does not exist in object 'browse_record(purchase.order, 8)'"

When creating a new record. I will try to use existing records and add manufacturer to my view see if it at least links.

Christian Parent Canada
5/6/14, 4:48 PM

I have modified the line a couple time... I am at 'manufacturer': fields.related('product_id', 'manufacturer', type="char", relation="product.product", string="Manufacturier", store=True), this at least gives me something in the DB : browse_record(res.partner, 1654) 1654 is the right manufacturer, so getting close but just not there yet !!!

Christian Parent Canada
5/6/14, 2:04 PM

I dont know if it is the way we are doing it but, it does not seem to work. The manufacturer of the product already exist in the product.product table, it is his id number from res.partner. The things tried so far does not work, see my comment above.

Remember, I want to add the field manufacturer to purchase.order.line table. The line in this table consist of each individual product ordered in an invoice.

I have managed to add the manufacturer reference code thru :

'manufacturer_pref': fields.related('product_id', 'manufacturer_pref', type="char", relation="product.product", string="Manufacturer Code", store=True),

So, I use the product_id from purchase_order_line which is the primary key (ID) in the table product.product. with that, I can get the manufacturer_pref which is already in the product.product table.

When I try to do similar to this for manufacturer name (manufacturer) It gives me errors.

I have all the logic :

Product_id in purchase_order_line is related to id in product.product. Each product in product.product has a field manufacturer which contains the id (Primary Key) of the res.partner table.

What I need to get in purchase_order_line is the field "name" from res.partner .... Is this more clear ?

Ask a Question
Keep Informed
0 follower(s)
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