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.
In Odoo 9:
am not finding a way to get the value of compute fields in the create method. However the same had achieved in other version by calling the function of compute-fields,
Say for instance in Sale Order:
'amount_total' is a compute field which calls the function "_amount_all" to calculate the amount.
Now in create method, the value for amount_total is yet to be filled hence in order to access it, one can just call the function _amount_all which will evaluate and return the value of amount_total.
So same way I would like to do in Odoo 9 as well, but not sure whether it is due to this api decorator or so, am unable to achieve .
Any thoughts are welcomed.
The compute method or the compute fields are activated or being calculated while rendering the related view. If you want this values on create method then you have to do the same function on create method also. or next change is to trigger the function explicitly from the create method.
you need to do something like this,
this Function uses to get the ratification amount in words.
for rec in self:
self.amount_words_letters = amount_to_text((self.amount_currency or 0.00))
amount_text= fields.Char(compute='_amount_in_words', string='Amount In Words', store=True)
Edit by: Anil
I hope I helped you.
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: 8/31/16, 2:35 AM|
|Seen: 3330 times|
|Last updated: 2/15/18, 8:02 PM|