summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaphael Collet <rco@odoo.com>2020-11-09 16:29:19 +0000
committerFanny He <fah@odoo.com>2020-11-16 15:15:22 +0000
commit8a9617d045c2afda8d804a5863df927012f0692c (patch)
tree7d078f925e16aa4f28c526e65d2111b2d664bdb7
parentef1b3332a523f0afdb954f8eb2abb8f442bdca58 (diff)
[FIX] core: decimal precision after update
When modifying a field's decimal precision, the caches are cleared in order to retrieve the new value from the database. As the new value is retrieved in pure SQL, one has to flush the updates before doing the query!
-rw-r--r--odoo/addons/base/models/decimal_precision.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/odoo/addons/base/models/decimal_precision.py b/odoo/addons/base/models/decimal_precision.py
index 47281b4a1b8..11f50b3415c 100644
--- a/odoo/addons/base/models/decimal_precision.py
+++ b/odoo/addons/base/models/decimal_precision.py
@@ -28,6 +28,7 @@ class DecimalPrecision(models.Model):
@api.model
@tools.ormcache('application')
def precision_get(self, application):
+ self.flush(['name', 'digits'])
self.env.cr.execute('select digits from decimal_precision where name=%s', (application,))
res = self.env.cr.fetchone()
return res[0] if res else 2