Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
How to modify "default_code" field for a "product_template" provided that you have that "product_template" ID
I am trying to understand how to modify a given field. Say "default_code" for a "product_template".
I want to modify "default_code" field of "product_template" in a custom method of "product_product". I have the "id" value of the "product_template" item I want to modify.
I am sure it is fairly basic and easy but I am still learning the basics.
How do you recover the right product_template object having its ID and how do you change default_code to FOOBAR?
Actually 'default_code' field which you are trying to update/modify does not exist in "product_template", inspite it is in "product_product" object.
In the same way first you have to identify the object of the given field to modify and then get its record id and simply use write method to modify the field's data.
So if you are having id of 'product_template' object then you can search the corresponding 'product_product' id using "product_tmpl_id" field at product_product master and finally update the value of 'default_code' field using write method of product_product.
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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 7/10/15, 1:11 AM|
|Seen: 634 times|
|Last updated: 7/10/15, 4:58 PM|