From e268c150e6d31e2dca1cb3f2c28d28092ebcbc58 Mon Sep 17 00:00:00 2001 From: Raimon Esteve Date: Tue, 25 Jan 2022 23:26:47 +0100 Subject: [PATCH] Add company to on_change_invoice_line depends issue11006 review374381002 --- account.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/account.py b/account.py index d792a840f3..66534bd662 100644 --- a/account.py +++ b/account.py @@ -164,7 +164,7 @@ class InvoiceDeferred(Workflow, ModelSQL, ModelView): if journals: self.journal, = journals - @fields.depends('invoice_line', 'start_date') + @fields.depends('invoice_line', 'start_date', 'company') def on_change_invoice_line(self): pool = Pool() Currency = pool.get('currency.currency') @@ -172,7 +172,7 @@ class InvoiceDeferred(Workflow, ModelSQL, ModelView): if not self.start_date: self.start_date = self.invoice_line.invoice.invoice_date invoice = self.invoice_line.invoice - if invoice.currency != self.company.currency: + if self.company and invoice.currency != self.company.currency: with Transaction().set_context(date=invoice.currency_date): self.amount = Currency.compute( invoice.currency, self.invoice_line.amount,