From 5a4f26bf372c910d5fa154428ed0e7b20a648e36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 18 Sep 2008 12:24:04 +0200 Subject: [PATCH] Improve on_change_with_amount if there is no currency --- invoice.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/invoice.py b/invoice.py index db850eebe5..1e2d799c74 100644 --- a/invoice.py +++ b/invoice.py @@ -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,