changeset 56d8a76f49f4 in modules/account_product:6.0
details:
https://hg.tryton.org/modules/account_product?cmd=changeset&node=56d8a76f49f4
description:
Restore instance context when getting account used
The account_used is set on property so it is executed under the
transaction
context but we expect to have the account from the company set in the
instance
context.
issue10557
review355371002
(grafted from 399364eeb545465bc45fe681270c1a34efe18958)
diffstat:
product.py | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diffs (15 lines):
diff -r 8c96423daa8f -r 56d8a76f49f4 product.py
--- a/product.py Thu Jul 01 21:47:16 2021 +0200
+++ b/product.py Wed Jul 21 23:54:13 2021 +0200
@@ -191,7 +191,10 @@
if self.account_parent:
return self.parent.get_account(name, **pattern)
else:
- return self.get_multivalue(name[:-5], **pattern)
+ transaction = Transaction()
+ with transaction.reset_context(), \
+ transaction.set_context(self._context):
+ return self.get_multivalue(name[:-5], **pattern)
def get_taxes(self, name):
company = Transaction().context.get('company')