From 46e430956ee7b2c4eebbd6ac484bf67bb8009a63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 30 Jan 2019 09:42:11 +0100 Subject: [PATCH] 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 --- move.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/move.py b/move.py index 17ad5a1a99..02ddbda919 100644 --- a/move.py +++ b/move.py @@ -932,12 +932,12 @@ class Line(ModelSQL, ModelView): fiscalyear_ids = list(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: