changeset 6d6edd30fca8 in modules/account_invoice:default
details: 
https://hg.tryton.org/modules/account_invoice?cmd=changeset;node=6d6edd30fca8
description:
        Show last invoice in numbering error

        issue10075
        review333881002
diffstat:

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

diffs (24 lines):

diff -r 61f7f40ba7bb -r 6d6edd30fca8 invoice.py
--- a/invoice.py        Sun Feb 14 15:48:44 2021 +0100
+++ b/invoice.py        Sun Feb 14 15:51:51 2021 +0100
@@ -449,6 +449,11 @@
         else:
             return ['expense']
 
+    @classmethod
+    def order_accounting_date(cls, tables):
+        table, _ = tables[None]
+        return [Coalesce(table.accounting_date, table.invoice_date)]
+
     @fields.depends('party', 'type')
     def on_change_party(self):
         self.invoice_address = None
@@ -1048,7 +1053,7 @@
                                     ('invoice_date', '>', date),
                                     ],
                                 ],
-                            ], limit=1)
+                            ], limit=1, order=[('accounting_date', 'DESC')])
                 if after_invoices:
                     after_invoice, = after_invoices
                     raise InvoiceNumberError(

Reply via email to