From 8f9d06743f32131c8757f84a88347d9b627770be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 18 Nov 2018 12:05:42 +0100 Subject: [PATCH] Ensure GL per periods or dates are the same We should not use nonexistent period ids in the context and the start_date must be excluded from the start computation because it is included in the range (query_get use greater and lesser or equal). issue7628 review60421002 --- account.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/account.py b/account.py index 6fb6e21437..3fa807da58 100644 --- a/account.py +++ b/account.py @@ -1325,7 +1325,7 @@ class GeneralLedgerAccount(ActivePeriodMixin, ModelSQL, ModelView): period = None if name.startswith('start_'): - period_ids = [0] + period_ids = [] if context.get('start_period'): period = Period(context['start_period']) elif name.startswith('end_'): @@ -1351,7 +1351,10 @@ class GeneralLedgerAccount(ActivePeriodMixin, ModelSQL, ModelView): def get_dates(cls, name): context = Transaction().context if name.startswith('start_'): - return None, context.get('from_date') + from_date = context.get('from_date') + if from_date: + from_date -= datetime.timedelta(days=1) + return None, from_date elif name.startswith('end_'): return None, context.get('to_date') return None, None