[POS-commit] r3273 - stoqlib/trunk/stoqlib/domain

Evandro Vale Miquelito evandro at async.com.br
Mon Apr 10 18:41:29 BRT 2006


Author: evandro
Date: Mon Apr 10 18:41:29 2006
New Revision: 3273

Modified:
   stoqlib/trunk/stoqlib/domain/product.py

Log:
Do not try to get a model connection before specifing it and calling
sysparam on its proper place


Modified: stoqlib/trunk/stoqlib/domain/product.py
==============================================================================
--- stoqlib/trunk/stoqlib/domain/product.py	(original)
+++ stoqlib/trunk/stoqlib/domain/product.py	Mon Apr 10 18:41:29 2006
@@ -265,8 +265,6 @@
 
     def __init__(self, _original=None, *args, **kwargs):
         ModelAdapter.__init__(self, _original, *args, **kwargs)
-        conn = self.get_connection()
-        self.precision = sysparam(conn).DECIMAL_PRECISION
 
     #
     # IContainer implementation
@@ -403,7 +401,9 @@
 
     def get_full_balance_string(self, branch=None, full_balance=None):
         full_balance = full_balance or self.get_full_balance(branch)
-        return '%.*f' % (int(self.precision), full_balance)
+        conn = self.get_connection()
+        precision = sysparam(conn).DECIMAL_PRECISION
+        return '%.*f' % (int(precision), full_balance)
 
     #
     # General methods


More information about the POS-commit mailing list