Select all periods ending before the end period
But exclude period of one day on the last day of the period. issue10961 review427691003
This commit is contained in:
1 parent
f0559e37fb
commit
91162ec872
1 file changed
+8
-1
+8
-1
@@ -1892,9 +1892,16 @@ class _GeneralLedgerAccount(ActivePeriodMixin, ModelSQL, ModelView):
|
||||
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)
|
||||
|
||||
Reference in new issue
Block a user