[FIX] decimal_precision: properly invalidate cache when changing precisions

This was working previously because the cache was disabled,
due to bug #988743. Now that the cache is working again,
it needs to be properly invalidated whenever a decimal.precision
record is created or deleted, otherwise all computations
will use an incorrect precision.

bzr revid: odo@openerp.com-20120523085234-2q8z7f1naydnjgsz
This commit is contained in:
Olivier Dony 2012-05-23 10:52:34 +02:00
parent 7c18cd8f04
commit 0373019bcf
1 changed files with 10 additions and 0 deletions

View File

@ -43,6 +43,16 @@ class decimal_precision(osv.osv):
res = cr.fetchone()
return res[0] if res else 2
def create(self, cr, uid, data, context=None):
res = super(decimal_precision, self).create(cr, uid, data, context=context)
self.precision_get.clear_cache(self)
return res
def unlink(self, cr, uid, ids, context=None):
res = super(decimal_precision, self).unlink(cr, uid, ids, context=context)
self.precision_get.clear_cache(self)
return res
def write(self, cr, uid, ids, data, *args, **argv):
res = super(decimal_precision, self).write(cr, uid, ids, data, *args, **argv)
self.precision_get.clear_cache(self)