changeset 8b4c201363d2 in modules/account:default
details: https://hg.tryton.org/modules/account?cmd=changeset&node=8b4c201363d2
description:
        Select all periods ending before the end period

        But exclude period of one day on the last day of the period.

        issue10961
        review427691003
diffstat:

 account.py |  9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diffs (21 lines):

diff -r ffedd8c5b4cc -r 8b4c201363d2 account.py
--- a/account.py        Fri Sep 16 23:37:38 2022 +0200
+++ b/account.py        Sun Sep 25 20:17:02 2022 +0200
@@ -1892,9 +1892,16 @@
                     period, = periods
 
         if period:
+            if name.startswith('start_'):
+                date_clause = ('end_date', '<=', period.start_date)
+            else:
+                date_clause = [
+                    ('end_date', '<=', period.end_date),
+                    ('start_date', '<', period.end_date),
+                    ]
             periods = Period.search([
                     ('fiscalyear', '=', context.get('fiscalyear')),
-                    ('end_date', '<=', period.start_date),
+                    date_clause,
                     ])
             if period.start_date == period.end_date:
                 periods.append(period)

Reply via email to