changeset 0d42af3244b9 in modules/account:default
details: https://hg.tryton.org/modules/account?cmd=changeset&node=0d42af3244b9
description:
Support date range context for account type amount
issue10346
review346041008
diffstat:
CHANGELOG | 1 +
account.py | 11 +++++++----
2 files changed, 8 insertions(+), 4 deletions(-)
diffs (34 lines):
diff -r 0dfc061280bf -r 0d42af3244b9 CHANGELOG
--- a/CHANGELOG Mon Aug 08 22:19:22 2022 +0200
+++ b/CHANGELOG Sun Sep 11 15:15:12 2022 +0200
@@ -1,3 +1,4 @@
+* Support date range context for account type amount
* Use context model for chart of accounts and taxes
Version 6.4.0 - 2022-05-02
diff -r 0dfc061280bf -r 0d42af3244b9 account.py
--- a/account.py Mon Aug 08 22:19:22 2022 +0200
+++ b/account.py Sun Sep 11 15:15:12 2022 +0200
@@ -310,15 +310,18 @@
for type_ in childs:
type_sum[type_.id] = Decimal('0.0')
+ period_ids = from_date = to_date = None
if context.get('start_period') or context.get('end_period'):
start_period_ids = GeneralLedger.get_period_ids('start_%s' % name)
end_period_ids = GeneralLedger.get_period_ids('end_%s' % name)
period_ids = list(
set(end_period_ids).difference(set(start_period_ids)))
- else:
- period_ids = None
-
- with Transaction().set_context(periods=period_ids):
+ elif context.get('from_date') or context.get('to_date'):
+ from_date, _ = GeneralLedger.get_dates('start_%s' % name)
+ _, to_date = GeneralLedger.get_dates('end_%s' % name)
+
+ with Transaction().set_context(
+ periods=period_ids, from_date=from_date, to_date=to_date):
accounts = Account.search([
('type', 'in', [t.id for t in childs]),
])