Commit d7045d72 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Apply UnrestrictedMethod for simulation to avoid security checks. Probably...

Apply UnrestrictedMethod for simulation to avoid security checks. Probably this is still not good enough.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18495 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 69b25ad2
...@@ -34,9 +34,9 @@ from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface ...@@ -34,9 +34,9 @@ from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5.Document.Movement import Movement from Products.ERP5.Document.Movement import Movement
from Products.ERP5.Document.ImmobilisationDelivery import ImmobilisationDelivery from Products.ERP5.Document.ImmobilisationDelivery import ImmobilisationDelivery
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
from zLOG import LOG from zLOG import LOG, PROBLEM
from zLOG import PROBLEM
class Delivery(XMLObject, ImmobilisationDelivery): class Delivery(XMLObject, ImmobilisationDelivery):
""" """
...@@ -654,8 +654,7 @@ class Delivery(XMLObject, ImmobilisationDelivery): ...@@ -654,8 +654,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
########################################################################## ##########################################################################
# Applied Rule stuff # Applied Rule stuff
def updateAppliedRule(self, rule_reference=None, rule_id=None, force=0, def updateAppliedRule(self, *args, **kw):
**kw):
""" """
Create a new Applied Rule if none is related, or call expand Create a new Applied Rule if none is related, or call expand
on the existing one. on the existing one.
...@@ -666,6 +665,11 @@ class Delivery(XMLObject, ImmobilisationDelivery): ...@@ -666,6 +665,11 @@ class Delivery(XMLObject, ImmobilisationDelivery):
If no rule is found, simply pass rule_reference to _createAppliedRule, If no rule is found, simply pass rule_reference to _createAppliedRule,
to keep compatibility vith the previous behaviour to keep compatibility vith the previous behaviour
""" """
updateAppliedRule = UnrestrictedMethod(self._updateAppliedRule)
return updateAppliedRule(*args, **kw)
def _updateAppliedRule(self, rule_reference=None, rule_id=None, force=0,
**kw):
if rule_id is not None: if rule_id is not None:
from warnings import warn from warnings import warn
warn('rule_id to updateAppliedRule is deprecated; use rule_reference instead', warn('rule_id to updateAppliedRule is deprecated; use rule_reference instead',
...@@ -736,12 +740,16 @@ class Delivery(XMLObject, ImmobilisationDelivery): ...@@ -736,12 +740,16 @@ class Delivery(XMLObject, ImmobilisationDelivery):
activate_kw=activate_kw, **kw) activate_kw=activate_kw, **kw)
security.declareProtected(Permissions.ModifyPortalContent, 'expand') security.declareProtected(Permissions.ModifyPortalContent, 'expand')
def expand(self, applied_rule_id=None, force=0, activate_kw=None,**kw): def expand(self, *args,**kw):
""" """
Reexpand applied rule Reexpand applied rule
Also reexpand all rules related to movements Also reexpand all rules related to movements
""" """
expand = UnrestrictedMethod(self._expand)
return expand(*args, **kw)
def _expand(self, applied_rule_id=None, force=0, activate_kw=None,**kw):
excluded_rule_path_list = [] excluded_rule_path_list = []
if applied_rule_id is not None: if applied_rule_id is not None:
my_applied_rule = self.portal_simulation.get(applied_rule_id, None) my_applied_rule = self.portal_simulation.get(applied_rule_id, 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