Commit 662a1a6e authored by Alexandre Boeglin's avatar Alexandre Boeglin

- 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
parent d05866cc
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment