[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!

X-original-commit: 8a9617d045c2afda8d804a5863df927012f0692c
This commit is contained in:
Raphael Collet
2020-11-24 19:06:38 +00:00
committed by Fanny He
parent f52b1655c1
commit eff6ce5e48
@@ -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