From 2e028d305b5945ae21fdf852fb9114a2e60588dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 3 Jun 2019 15:27:41 +0200 Subject: [PATCH] Always filter out invoice without move in _update_tax_cash_basis process and cancel can call the method on invoice without move for example if the invoice is empty. issue8348 review263531002 --- account.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/account.py b/account.py index bb49fd3a48..67836ad504 100644 --- a/account.py +++ b/account.py @@ -275,7 +275,6 @@ class Invoice(metaclass=PoolMeta): if 'payment_lines' in values: invoices.extend(records) invoices = cls.browse(sum(args[0:None:2], [])) - invoices = [i for i in invoices if i.move] cls._update_tax_cash_basis(invoices) @classmethod @@ -303,6 +302,8 @@ class Invoice(metaclass=PoolMeta): date = Transaction().context.get('payment_date', Date.today()) periods = {} for invoice in invoices: + if not invoice.move: + continue if invoice.company not in periods: periods[invoice.company] = Period.find( invoice.company.id, date=date)