Commit 1f3dbf74 authored by Julien Muchembled's avatar Julien Muchembled

Remove deprecated Resource.getPricingVariable

Default getPriceCalculationOperandDict script calls getPricingVariable
type-based script directly if variable_additional_price is not 0.
parent 24fc40f8
......@@ -87,12 +87,18 @@ for x in ("additional_price",\n
"surcharge_ratio"):\n
result[x] = sum(result[x])\n
\n
unit_base_price = (base_price\n
# Sum additional price\n
+ result["additional_price"]\n
# Sum variable additional price\n
+ result["variable_additional_price"] \\\n
* context.getPricingVariable(context=movement))\n
unit_base_price = result["variable_additional_price"]\n
if unit_base_price:\n
method = None if movement is None else \\\n
movement.getTypeBasedMethod("getPricingVariable")\n
if method is None:\n
method = context.getTypeBasedMethod("getPricingVariable")\n
if method is None:\n
unit_base_price = 0\n
else:\n
unit_base_price *= method()\n
\n
unit_base_price += base_price + result["additional_price"]\n
\n
# Discount\n
d_ratio = max(result["discount_ratio"], result[\'exclusive_discount_ratio\'] or 0)\n
......
580
\ No newline at end of file
581
\ No newline at end of file
......@@ -709,26 +709,6 @@ class Resource(XMLObject, XMLMatrix, VariatedMixin):
price_parameter_dict[mapped_value_property] = value
return price_parameter_dict
security.declareProtected(Permissions.AccessContentsInformation,
'getPricingVariable')
def getPricingVariable(self, context=None):
"""
Return the value of the property used to calculate variable pricing
This basically calls a script like Product_getPricingVariable
"""
warn('Resource.getPricingVariable is deprecated; Please use' \
' a type-based method for getPrice, and call whatever scripts' \
' you need to invoke from that method.', DeprecationWarning)
method = None
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())
security.declareProtected(Permissions.AccessContentsInformation,
'getPriceCalculationOperandDict')
def getPriceCalculationOperandDict(self, default=None, context=None,
......
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