Manage None as value of field in on_change method

issue6069
review27851002
This commit is contained in:
Cédric Krier committed 2016-11-27 22:15:01 +01:00
1 parent 3bae0d09c0
commit e3e92f6f58
1 file changed
+8 -3
+8 -3
View File
@@ -2464,11 +2464,16 @@ class PayInvoiceAsk(ModelView):
def on_change_lines(self):
Currency = Pool().get('currency.currency')
with Transaction().set_context(date=self.date):
amount = Currency.compute(self.currency, self.amount,
self.currency_writeoff)
if self.currency and self.currency_writeoff:
with Transaction().set_context(date=self.date):
amount = Currency.compute(self.currency, self.amount,
self.currency_writeoff)
else:
amount = self.amount
self.amount_writeoff = Decimal('0.0')
if not self.invoice:
return
for line in self.lines:
self.amount_writeoff += line.debit - line.credit
for line in self.payment_lines: