details: https://code.tryton.org/tryton/commit/488439bb54cc
branch: default
user: Adrián Bernardi <[email protected]>
date: Thu Feb 19 13:07:37 2026 +0100
description:
Use the same context for the account getter and searcher of general
ledger
Closes #14590
diffstat:
modules/account/account.py | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
diffs (49 lines):
diff -r 1df7b3f5e2ff -r 488439bb54cc modules/account/account.py
--- a/modules/account/account.py Mon Dec 15 17:03:51 2025 +0100
+++ b/modules/account/account.py Thu Feb 19 13:07:37 2026 +0100
@@ -1974,12 +1974,10 @@
return None, None
@classmethod
- def get_account(cls, records, name):
+ def _account_context(cls, name):
pool = Pool()
LedgerAccountContext = pool.get(
'account.general_ledger.account.context')
- Account = cls._get_account()
-
period_ids, from_date, to_date = None, None, None
context = LedgerAccountContext.get_context()
if context.get('start_period') or context.get('end_period'):
@@ -1989,10 +1987,17 @@
else:
if name.startswith('start_'):
period_ids = []
-
- with Transaction().set_context(
- periods=period_ids,
- from_date=from_date, to_date=to_date):
+ return {
+ 'periods': period_ids,
+ 'from_date': from_date,
+ 'to_date': to_date,
+ }
+
+ @classmethod
+ def get_account(cls, records, name):
+ Account = cls._get_account()
+
+ with Transaction().set_context(cls._account_context(name)):
accounts = Account.browse(records)
fname = name
for test in ['start_', 'end_']:
@@ -2005,8 +2010,7 @@
def search_account(cls, name, domain):
Account = cls._get_account()
- period_ids = cls.get_period_ids(name)
- with Transaction().set_context(periods=period_ids):
+ with Transaction().set_context(cls._account_context(name)):
accounts = Account.search([], order=[])
_, operator_, operand = domain