Commit eb137c31 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

invoke getPriceCalculationOperandDict script in unrestricted_apply.

so that :
* the result is stable.
* no permission is required for Supply and Resource only for price calculation.
* no proxy role is required in script.
parent 97a54fdf
...@@ -38,6 +38,7 @@ from Products.ERP5Type.Base import Base ...@@ -38,6 +38,7 @@ from Products.ERP5Type.Base import Base
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
from Products.ERP5Type.UnrestrictedMethod import unrestricted_apply
from Products.ERP5.mixin.amount_generator import AmountGeneratorMixin from Products.ERP5.mixin.amount_generator import AmountGeneratorMixin
from Products.ERP5.mixin.composition import CompositionMixin from Products.ERP5.mixin.composition import CompositionMixin
from Products.ERP5.Document.Amount import Amount from Products.ERP5.Document.Amount import Amount
...@@ -272,7 +273,7 @@ class Movement(XMLObject, Amount, CompositionMixin, AmountGeneratorMixin): ...@@ -272,7 +273,7 @@ class Movement(XMLObject, Amount, CompositionMixin, AmountGeneratorMixin):
# not searched. # not searched.
method = getattr(context, 'Movement_getPriceCalculationOperandDict', None) method = getattr(context, 'Movement_getPriceCalculationOperandDict', None)
if method is not None: if method is not None:
operand_dict = method(**kw) operand_dict = unrestricted_apply(method, kw=kw)
if operand_dict is None: if operand_dict is None:
return default return default
assert 'price' in operand_dict assert 'price' in operand_dict
......
...@@ -37,6 +37,7 @@ from Products.ERP5Type import Permissions, PropertySheet ...@@ -37,6 +37,7 @@ from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.XMLMatrix import XMLMatrix from Products.ERP5Type.XMLMatrix import XMLMatrix
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5Type.Base import Base from Products.ERP5Type.Base import Base
from Products.ERP5Type.UnrestrictedMethod import unrestricted_apply
from Products.ERP5Type.Utils import cartesianProduct from Products.ERP5Type.Utils import cartesianProduct
from Products.ERP5.mixin.variated import VariatedMixin from Products.ERP5.mixin.variated import VariatedMixin
...@@ -747,7 +748,8 @@ class Resource(XMLObject, XMLMatrix, VariatedMixin): ...@@ -747,7 +748,8 @@ class Resource(XMLObject, XMLMatrix, VariatedMixin):
# (i.e. a movement). # (i.e. a movement).
method = self._getTypeBasedMethod('getPriceCalculationOperandDict') method = self._getTypeBasedMethod('getPriceCalculationOperandDict')
if method is not None: if method is not None:
return method(default=default, movement=context, REQUEST=REQUEST, **kw) return unrestricted_apply(method, kw=dict(
default=default, movement=context, REQUEST=REQUEST, **kw))
# Next, try an old type-based method which returns only a final result. # Next, try an old type-based method which returns only a final result.
method = self._getTypeBasedMethod('getPrice') method = self._getTypeBasedMethod('getPrice')
......
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