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
This commit is contained in:
Cédric Krier committed 2018-11-18 12:05:42 +01:00
1 parent 944e103b1e
commit 8f9d06743f
1 file changed
+5 -2
+5 -2
View File
@@ -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