From 5a4fba67b50a14a10e126cac40e381600c42e2ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 13 Apr 2011 16:57:46 +0200 Subject: [PATCH] Fix usage of _parent_invoice.currency_date in on_change The value could be empty so we must use today instead of trying to read the field invoice. --- invoice.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/invoice.py b/invoice.py index f29533aa38..4c46ca0801 100644 --- a/invoice.py +++ b/invoice.py @@ -1537,8 +1537,9 @@ class InvoiceLine(ModelSQL, ModelView): company = company_obj.browse(Transaction().context['company']) currency = None currency_date = date_obj.today() - if vals.get('_parent_invoice.currency_date'): - currency_date = vals['_parent_invoice.currency_date'] + if '_parent_invoice.currency_date' in vals: + if vals['_parent_invoice.currency_date']: + currency_date = vals['_parent_invoice.currency_date'] elif vals.get('invoice'): invoice = invoice_obj.browse(vals['invoice']) currency_date = invoice.currency_date