details: https://code.tryton.org/tryton/commit/d6e797ed25c6
branch: default
user: Cédric Krier <[email protected]>
date: Thu Apr 02 17:57:12 2026 +0200
description:
Use party with origin's company in the context to retrieve accounts
when applying statement rule
Closes #14740
diffstat:
modules/account_statement_rule/account.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diffs (23 lines):
diff -r 532e2b8635e5 -r d6e797ed25c6 modules/account_statement_rule/account.py
--- a/modules/account_statement_rule/account.py Thu Apr 02 17:26:12 2026 +0200
+++ b/modules/account_statement_rule/account.py Thu Apr 02 17:57:12 2026 +0200
@@ -319,6 +319,7 @@
def get_line(self, origin, keywords, **context):
pool = Pool()
Line = pool.get('account.statement.line')
+ Party = pool.get('party.party')
context.setdefault('functions', {})['Decimal'] = Decimal
context.setdefault('names', {}).update(keywords)
@@ -345,7 +346,10 @@
if related_to_account:
account = related_to_account
elif party:
- with Transaction().set_context(date=origin.date):
+ with Transaction().set_context(
+ date=origin.date,
+ company=origin.company.id):
+ party = Party(party.id)
if amount > Decimal(0):
account = party.account_receivable_used
else: