From 662a1a6e06d59754438cf0963d56b0a5fece1510 Mon Sep 17 00:00:00 2001 From: Alexandre Boeglin <alex@nexedi.com> Date: Fri, 24 Feb 2006 21:43:53 +0000 Subject: [PATCH] - try to use context when getting the variable property in pricing - renamed a method call to follow the new getPortalSupplyPathTypeList git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5842 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/Resource.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/product/ERP5/Document/Resource.py b/product/ERP5/Document/Resource.py index c9321c6929..b10785733a 100755 --- a/product/ERP5/Document/Resource.py +++ b/product/ERP5/Document/Resource.py @@ -536,7 +536,7 @@ class Resource(XMLMatrix, CoreResource, Variated): # to get some price values. mapped_value_list = [] domain_tool = getToolByName(self,'portal_domains') - portal_type_list = self.getPortalSupplyTypeList() + portal_type_list = self.getPortalSupplyPathTypeList() category_list_list = [no_option_category_list] + \ [no_option_category_list+[x] for x in option_category_list] @@ -578,12 +578,16 @@ class Resource(XMLMatrix, CoreResource, Variated): security.declareProtected(Permissions.AccessContentsInformation, '_getPricingVariable') - def _getPricingVariable(self): + def _getPricingVariable(self, context=None): """ Return the value of the property used to calculate variable pricing This basically calls a script like Product_getPricingVariable """ - method = self._getTypeBasedMethod('_getPricingVariable') + if context is not None: + method = context._getTypeBasedMethod('_getPricingVariable') + if method is None or context is None: + method = self._getTypeBasedMethod('_getPricingVariable') + if method is None: return 0.0 return float(method()) @@ -622,7 +626,7 @@ class Resource(XMLMatrix, CoreResource, Variated): for additional_price in price_parameter_dict['additional_price']: unit_base_price += additional_price # Sum variable additional price - variable_value = self._getPricingVariable() + variable_value = self._getPricingVariable(context=context) for variable_additional_price in price_parameter_dict['variable_additional_price']: unit_base_price += variable_additional_price * variable_value # Discount -- 2.30.9