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.
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
|Asked: 7/10/15, 1:11 AM|
|Seen: 383 times|
|Last updated: 7/10/15, 4:58 PM|