From 175ec95a4923f215ea8168d0c6641a1bc6ef69bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 24 Oct 2019 19:06:04 +0200 Subject: [PATCH] Avoid override invoices variable when search other invoices The invoices list should not be modified because it is saved at the end of the method. issue8724 review286051003 --- invoice.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/invoice.py b/invoice.py index 22002321ea..c151d3ca01 100644 --- a/invoice.py +++ b/invoice.py @@ -1012,7 +1012,7 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin): date = accounting_date(invoice) # Do not need to lock the table # because sequence.get_id is sequential - invoices = cls.search([ + after_invoices = cls.search([ ('sequence', '=', invoice.sequence.id), ['OR', ('accounting_date', '>', date), @@ -1022,8 +1022,8 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin): ], ], ], limit=1) - if invoices: - after_invoice, = invoices + if after_invoices: + after_invoice, = after_invoices raise InvoiceNumberError( gettext('account_invoice.msg_invoice_number_after', invoice=invoice.rec_name,