Valencia Rodrigues (OpenERP) has proposed merging
lp:~openerp-dev/openobject-server/6.0-opw-17993-vro into
lp:openobject-server/6.0.
Requested reviews:
Raphael Collet (OpenERP) (rco-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-server/6.0-opw-17993-vro/+merge/78553
Hello,
If the "Rounding factor" (rounding) of a currency is set to 0.0, it will
nullify the value of rounded amounts.
To regenerate the issue (Case#17993):
1. Create a new currency with rounding left as 0.0
2. Use this currency in an invoice
3. Add invoice lines and observe that the Sub-total field has value 0.0 because
of rounding of the currency.
This fixes the issue.
This fix also sets the rounding default to 0.01
Thanks
--
https://code.launchpad.net/~openerp-dev/openobject-server/6.0-opw-17993-vro/+merge/78553
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-server/6.0-opw-17993-vro.
=== modified file 'bin/addons/base/res/res_currency.py'
--- bin/addons/base/res/res_currency.py 2011-07-13 15:32:10 +0000
+++ bin/addons/base/res/res_currency.py 2011-10-07 10:04:24 +0000
@@ -44,6 +44,13 @@
else:
res[id] = 0
return res
+
+ def _check_rounding(self, cr, uid, ids, context=None):
+ for currency in self.browse(cr, uid, ids, context=context):
+ if currency.rounding == 0.0:
+ return False
+ return True
+
_name = "res.currency"
_description = "Currency"
_columns = {
@@ -63,10 +70,13 @@
}
_defaults = {
'active': lambda *a: 1,
- 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'res.currency', context=c)
+ 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'res.currency', context=c),
+ 'rounding': lambda *a: 0.01
}
_order = "name"
+ _constraints = [(_check_rounding, "The rounding factor must not be 0 !",['rounding'])]
+
def read(self, cr, user, ids, fields=None, context=None, load='_classic_read'):
res=super(osv.osv, self).read(cr, user, ids, fields, context, load)
for r in res:
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp