diff options
| author | Olivier Dony <odo@openerp.com> | 2012-05-23 10:52:34 +0200 |
|---|---|---|
| committer | Olivier Dony <odo@openerp.com> | 2012-05-23 10:52:34 +0200 |
| commit | 0373019bcf8bfb16d8db981cd76d0cec84d261f7 (patch) | |
| tree | c9767e4c52ddb481280414e54b383260eaffc71f | |
| parent | 7c18cd8f049bd4a940a5f5990486242f5e482f84 (diff) | |
[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
| -rw-r--r-- | addons/decimal_precision/decimal_precision.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/addons/decimal_precision/decimal_precision.py b/addons/decimal_precision/decimal_precision.py index d9f6aa7b8db..7825f56bc62 100644 --- a/addons/decimal_precision/decimal_precision.py +++ b/addons/decimal_precision/decimal_precision.py @@ -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) |
