changeset 491d585d8424 in modules/account:default
details: https://hg.tryton.org/modules/account?cmd=changeset&node=491d585d8424
description:
Compute the periods for type amount the same way as general ledger
issue11039
review376171002
diffstat:
account.py | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diffs (29 lines):
diff -r d471d45ddc05 -r 491d585d8424 account.py
--- a/account.py Thu Dec 16 22:39:44 2021 +0100
+++ b/account.py Thu Dec 16 22:42:53 2021 +0100
@@ -293,6 +293,7 @@
pool = Pool()
Account = pool.get('account.account')
GeneralLedger = pool.get('account.general_ledger.account')
+ context = Transaction().context
res = {}
for type_ in types:
@@ -305,10 +306,13 @@
for type_ in childs:
type_sum[type_.id] = Decimal('0.0')
- 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)))
+ 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):
accounts = Account.search([