changeset b467272bf61a in modules/account_invoice_defer:6.0
details: 
https://hg.tryton.org/modules/account_invoice_defer?cmd=changeset&node=b467272bf61a
description:
        Add company to on_change_invoice_line depends

        issue11006
        review374381002
        (grafted from 0af0af5a339be1a1a9ef576888ebc782c3bf0455)
diffstat:

 account.py |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r b09407e920e2 -r b467272bf61a account.py
--- a/account.py        Sat Jan 15 16:27:25 2022 +0100
+++ b/account.py        Tue Jan 25 23:26:47 2022 +0100
@@ -164,7 +164,7 @@
         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 @@
             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,

Reply via email to