Subject: changeset in modules/account:4.6 Test contextual period_ids against 
None in Move.query_get
From: Cédric Krier <[email protected]>

changeset 5c7f9e5044f7 in modules/account:4.6
details: https://hg.tryton.org/modules/account?cmd=changeset;node=5c7f9e5044f7
description:
        Test contextual period_ids against None in Move.query_get

        The list may be empty for example when computing the GL starting 
balance, in
        this case no move line should be selected by query_get.

        issue7993
        review58481002
        (grafted from 8c4c1c2808f66005bf3f161d9a3ae0020ea37454)
diffstat:

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

diffs (19 lines):

diff -r d015cb486b86 -r 5c7f9e5044f7 move.py
--- a/move.py   Sat Jan 05 18:55:24 2019 +0100
+++ b/move.py   Wed Jan 30 09:42:11 2019 +0100
@@ -987,12 +987,12 @@
             fiscalyear_ids = map(int, fiscalyears)
             where &= period.fiscalyear == fiscalyear_id
             where &= move.date <= date
-        elif fiscalyear_id or period_ids or from_date or to_date:
+        elif fiscalyear_id or period_ids is not None or from_date or to_date:
             if fiscalyear_id:
                 fiscalyear_ids = [fiscalyear_id]
                 where &= fiscalyear.id == fiscalyear_id
-            if period_ids:
-                where &= move.period.in_(period_ids)
+            if period_ids is not None:
+                where &= move.period.in_(period_ids or [None])
             if from_date:
                 where &= move.date >= from_date
             if to_date:

Reply via email to