Improve on_change_with_amount if there is no currency

This commit is contained in:
Cédric Krier committed 2008-09-18 12:13:26 +02:00
1 parent 6e560d97dc
commit ee0677e62a
1 file changed
+5 -3
+5 -3
View File
@@ -939,9 +939,11 @@ class PurchaseLine(OSV):
vals['_parent_purchase.currency'], context=context)
else:
currency = vals['_parent_purchase.currency']
return currency_obj.round(cursor, user, currency,
Decimal(str(vals.get('quantity') or '0.0')) * \
(vals.get('unit_price') or Decimal('0.0')))
amount = Decimal(str(vals.get('quantity') or '0.0')) * \
(vals.get('unit_price') or Decimal('0.0'))
if currency:
return currency_obj.round(cursor, user, currency, amount)
return amount
return Decimal('0.0')
def get_amount(self, cursor, user, ids, name, arg, context=None):