changeset 054029270be7 in modules/product:6.0
details: https://hg.tryton.org/modules/product?cmd=changeset&node=054029270be7
description:
        Restore instance context when getting price list used

        The price_list_used is set on property so it is executed under the 
transaction
        context but we expect to have the price list from the company set in the
        instance context.

        issue10664
        review369491002
        (grafted from d8c73648423142c9b9d0aa5b762e0cff422a7606)
diffstat:

 product.py |  5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (15 lines):

diff -r 035c525dc7c6 -r 054029270be7 product.py
--- a/product.py        Mon May 03 15:40:46 2021 +0200
+++ b/product.py        Fri Aug 27 08:46:28 2021 +0200
@@ -579,7 +579,10 @@
 
     @property
     def list_price_used(self):
-        return self.template.get_multivalue('list_price')
+        transaction = Transaction()
+        with transaction.reset_context(), \
+                transaction.set_context(self._context):
+            return self.template.get_multivalue('list_price')
 
     @classmethod
     def sync_code(cls, products):

Reply via email to