Cédric Krier pushed to branch branch/default at Tryton / Tryton


Commits:
367bc23d by Cédric Krier at 2023-04-03T01:36:57+02:00
Do not retrieve multivalue model for product template function

Since f80dceebed73 the cost price method is retrieved using the multivalue API
and since 11921ff82223 get_multivalue on product calls the template method.
- - - - -


1 changed file:

- modules/product_cost_warehouse/product.py


Changes:

=====================================
modules/product_cost_warehouse/product.py
=====================================
@@ -2,6 +2,7 @@
 # this repository contains the full copyright notices and license terms.
 from trytond.model import ModelSQL, fields
 from trytond.modules.company.model import CompanyValueMixin
+from trytond.modules.product.product import TemplateFunction
 from trytond.pool import Pool, PoolMeta
 from trytond.pyson import Eval
 from trytond.transaction import Transaction
@@ -57,11 +58,12 @@
         pool = Pool()
         Company = pool.get('company.company')
         context = Transaction().context
-        Value = self.multivalue_model(name)
-        if issubclass(Value, CostPrice) and context.get('company'):
-            company = Company(context['company'])
-            if company.cost_price_warehouse:
-                pattern.setdefault('warehouse', context.get('warehouse'))
+        if not isinstance(self._fields[name], TemplateFunction):
+            Value = self.multivalue_model(name)
+            if issubclass(Value, CostPrice) and context.get('company'):
+                company = Company(context['company'])
+                if company.cost_price_warehouse:
+                    pattern.setdefault('warehouse', context.get('warehouse'))
         return super().get_multivalue(name, **pattern)
 
     def set_multivalue(self, name, value, save=True, **pattern):



View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/367bc23d767eaa1d53e73118c361359d93a3c5fa

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/367bc23d767eaa1d53e73118c361359d93a3c5fa
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to