Skip to Content
Menu
This question has been flagged
2 Replies
5288 Views

Compute Field Value dose not get updated after adding Store = True even when the depends fields changed

?

Avatar
Discard
Best Answer

Hi,
It will be nice if you add the relevant codes in the questions. In general the stored compute field will not recompute the value when the proper dependencies are not set for the compute function, as you mention the dependencies are set, i will recommend you to cross check once again and ensure all the needed dependencies are set.

Also for understanding the same, have a look at this video explaining the same case:
Stored Compute Field In Odoo And Its Dependency || Re computation Of Stored Compute Field
Thanks

Avatar
Discard
Best Answer

Hello Loay elhaj,

Please find below example it may help you,

Please find code in Comment. 

I hope this will help you. 

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Avatar
Discard

Example:

May be you have taken compute field without depends and you are trying to store data of field in database but due to store = True it will not update because old value store in database even though dependent field updated.

field_1 = field.Float('Field 1')
field_2 = field.Float('Field 2', compute='_compute_field', store=True)

@api.depends('field_1')
def _compute_field(self);
code....

You can refer below link for your reference:- https://www.odoo.com/documentation/15.0/developer/howtos/rdtraining/09_compute_onchange.html

Related Posts Replies Views Activity
4
Jun 22
7298
1
Feb 21
2752
4
Oct 20
7703
1
Nov 24
1483
1
Nov 24
1188