[FIX] report sxw: use cached decimal precision insteaf of search + browse
authorXavier ALT <xal@openerp.com>
Fri, 14 Dec 2012 13:10:52 +0000 (14:10 +0100)
committerXavier ALT <xal@openerp.com>
Fri, 14 Dec 2012 13:10:52 +0000 (14:10 +0100)
  This improve speed of report using get_digits() intensively
  (especially accounting report - like General Ledger)

bzr revid: xal@openerp.com-20121214131052-jlor6fzw4vhsectc

bin/report/report_sxw.py

index 3b8bd0e..b5df980 100644 (file)
@@ -248,9 +248,7 @@ class rml_parse(object):
         d = DEFAULT_DIGITS = 2
         if dp:
             decimal_precision_obj = self.pool.get('decimal.precision')
-            ids = decimal_precision_obj.search(self.cr, self.uid, [('name', '=', dp)])
-            if ids:
-                d = decimal_precision_obj.browse(self.cr, self.uid, ids)[0].digits
+            d = decimal_precision_obj.precision_get(self.cr, self.uid, dp)
         elif obj and f:
             res_digits = getattr(obj._columns[f], 'digits', lambda x: ((16, DEFAULT_DIGITS)))
             if isinstance(res_digits, tuple):