Skip to Content
Menu
This question has been flagged
1 Reply
9484 Views

Hello,
I would like some help please.

I am using odoo online Saas version (trial).
I have added one field "Consumption rate" into the model "product.template". I would like to get that field's value in another model "stock.pack.operation" in order to display it in the "stock.pack.operation form".
Basically the model "stock.pack.operation" has already the field "product_id" through which i can get from the model "product.template" my field "Consumption rate". But i don't know how to do that link between "stock.pack.operation" and "product.template" to get my "Consumption rate" field ????

Can anyone help me and give some tips on how to do that please ?
Thank you in advance.


Avatar
Discard
Author Best Answer

I don't know why no answer to my question even if i think it's purely beginner stuff.
Thank you for nothing anyway, I could figure out the answer in case another beginner like me will need to know how to do it without loosing time over making a post that nobody would answer :

I have succeeded to do it through "Dependencies" and "Compute" of the "consumption rate" field (in my case).
1) First, I have set "product_id" in the "Dependencies" in order to get the link of the "product.template" model from "stock.pack.operation" model through "product_id" key which exists in both models.
2) I have set in "Compute" the following python lines in order to make it automatic to get the value of "consumption rate" from the "product.template" model :
for record in self:
record['x_consumption_rate'] = record.product_id.x_consumption_rate

And now it is working. So i will make my own answer as the correct one (weirdthough).
kindest regards,

Avatar
Discard