changeset 70eab414cbbe in modules/account_invoice:default
details: 
https://hg.tryton.org/modules/account_invoice?cmd=changeset;node=70eab414cbbe
description:
        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
diffstat:

 invoice.py |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (23 lines):

diff -r 65f074cf2903 -r 70eab414cbbe invoice.py
--- a/invoice.py        Sat Sep 28 23:59:08 2019 +0200
+++ b/invoice.py        Thu Oct 24 19:06:04 2019 +0200
@@ -1012,7 +1012,7 @@
                 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 @@
                                     ],
                                 ],
                             ], 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,

Reply via email to