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.
This commit is contained in:
Cédric Krier
2011-04-13 16:57:46 +02:00
parent a5bdab3583
commit 5a4fba67b5
+3 -2
View File
@@ -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