From 54b4a987315af02978dbe47234e5ae86eadb8292 Mon Sep 17 00:00:00 2001 From: Vincent Pelletier <vincent@nexedi.com> Date: Wed, 14 Jun 2017 15:30:01 +0900 Subject: [PATCH] Movement_getPriceCalculationOperandDict: Use a SimpleQuery instead of raw SQL --- .../erp5_core/Movement_getPriceCalculationOperandDict.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Movement_getPriceCalculationOperandDict.py b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Movement_getPriceCalculationOperandDict.py index 5fb2b7aacf..6803a1886f 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Movement_getPriceCalculationOperandDict.py +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Movement_getPriceCalculationOperandDict.py @@ -1,3 +1,5 @@ +from Products.ZSQLCatalog.SQLCatalog import SimpleQuery + def getResourceInternalPriceSortKeyMethod(high_priority_supply_line_list): def resourceInternalPriceSortKeyMethod(a): high_priority_supply_line_list_len = len(high_priority_supply_line_list) @@ -70,9 +72,9 @@ def getOptimisedPriceCalculationOperandDict(default=None, context=None, **kw): for key in preferences.getPreferredPricingSupplyPathKeyCategoryList(): key_uid = '%s_uid' % key supply_kw['default_%s' % key_uid] = context.getProperty(key_uid) - supply_uid_list = [str(brain.uid) for brain in context.portal_catalog(**supply_kw)] - if len(supply_uid_list): - kw['query'] = ' catalog.uid IN (%s)' % ','.join(supply_uid_list) + supply_uid_list = [brain.uid for brain in context.portal_catalog(**supply_kw)] + if supply_uid_list: + kw['query'] = SimpleQuery(uid=supply_uid_list) else: return default return resource.getPriceCalculationOperandDict(default=default, context=context, **kw) -- 2.30.9