Round on currency
bzr revid: pinky-c8bda169634ffd0f078deaba5d6def90e167df74
This commit is contained in:
parent
722658e96d
commit
4335486ae8
|
@ -64,6 +64,9 @@ class res_currency(osv.osv):
|
||||||
}
|
}
|
||||||
_order = "code"
|
_order = "code"
|
||||||
|
|
||||||
|
def round(self, cr, uid, currency, amount):
|
||||||
|
return round(amount, currency.rouding)
|
||||||
|
|
||||||
def compute(self, cr, uid, from_currency_id, to_currency_id, from_amount):
|
def compute(self, cr, uid, from_currency_id, to_currency_id, from_amount):
|
||||||
if to_currency_id==from_currency_id:
|
if to_currency_id==from_currency_id:
|
||||||
return from_amount
|
return from_amount
|
||||||
|
@ -72,8 +75,6 @@ class res_currency(osv.osv):
|
||||||
if from_currency['rate'] == 0 or to_currency['rate'] == 0:
|
if from_currency['rate'] == 0 or to_currency['rate'] == 0:
|
||||||
raise osv.except_osv('Error', 'No rate found for the currency')
|
raise osv.except_osv('Error', 'No rate found for the currency')
|
||||||
return currency(from_amount * from_currency['rate']/to_currency['rate'], to_currency['accuracy'], to_currency['rounding'])
|
return currency(from_amount * from_currency['rate']/to_currency['rate'], to_currency['accuracy'], to_currency['rounding'])
|
||||||
|
|
||||||
|
|
||||||
res_currency()
|
res_currency()
|
||||||
|
|
||||||
class res_currency_rate(osv.osv):
|
class res_currency_rate(osv.osv):
|
||||||
|
|
Loading…
Reference in New Issue