Improve on_change_with_amount if there is no currency

This commit is contained in:
Cédric Krier committed 2008-09-18 12:24:04 +02:00
1 parent f3d641cb3c
commit 5a4f26bf37
1 file changed
+5 -3
+5 -3
View File
@@ -1336,9 +1336,11 @@ class InvoiceLine(OSV):
vals['_parent_invoice.currency'], context=context)
else:
currency = vals['_parent_invoice.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 on_change_with_unit_digits(self, cursor, user, ids, vals,