Commit ff9d47f1 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Make reindexObject public.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1058 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent aac85c7f
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
from Globals import InitializeClass, PersistentMapping from Globals import InitializeClass, PersistentMapping
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.CMFCore.utils import getToolByName
from Products.ERP5.Document.Delivery import Delivery from Products.ERP5.Document.Delivery import Delivery
...@@ -118,3 +119,11 @@ An order...""" ...@@ -118,3 +119,11 @@ An order..."""
) )
} }
security.declareProtected(Permissions.AccessContentsInformation, 'getSimulationState')
def getSimulationState(self, id_only=1):
"""
Returns the current state in simulation
"""
portal_workflow = getToolByName(self, 'portal_workflow')
wf = portal_workflow.getWorkflowById('accounting_workflow')
return wf._getWorkflowStateOf(self, id_only=id_only )
...@@ -262,7 +262,7 @@ An ERP5 Rule...""" ...@@ -262,7 +262,7 @@ An ERP5 Rule..."""
result.extend(m.getMovementIndex()) result.extend(m.getMovementIndex())
return result return result
security.declareProtected(Permissions.View, 'reindexObject') security.declarePublic('reindexObject')
def reindexObject(self, **kw): def reindexObject(self, **kw):
""" """
Only reindex root applied rule Only reindex root applied rule
......
...@@ -53,7 +53,7 @@ class Capacity(XMLObject): ...@@ -53,7 +53,7 @@ class Capacity(XMLObject):
pass pass
security.declareProtected(Permissions.ModifyPortalContent, 'reindexObject') security.declarePublic('reindexObject')
def reindexObject(self): def reindexObject(self):
""" """
Overload reindexing in order to forward any modifications of capacity Overload reindexing in order to forward any modifications of capacity
......
...@@ -348,7 +348,7 @@ a service in a public administration).""" ...@@ -348,7 +348,7 @@ a service in a public administration)."""
""" """
return self.getRootAppliedRule().hasActivity(**kw) return self.getRootAppliedRule().hasActivity(**kw)
security.declareProtected(Permissions.View, 'reindexObject') security.declarePublic('reindexObject')
def reindexObject(self, **kw): def reindexObject(self, **kw):
""" """
We reindex the whole applied rule (only once) We reindex the whole applied rule (only once)
......
...@@ -196,7 +196,9 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana ...@@ -196,7 +196,9 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana
if getattr(self, storage_id) != None: if getattr(self, storage_id) != None:
return getattr(self, storage_id) return getattr(self, storage_id)
# Retrieve the list of related objects # Retrieve the list of related objects
#LOG("Get Acquired Property self",0,str(self))
#LOG("Get Acquired Property portal_type",0,str(portal_type)) #LOG("Get Acquired Property portal_type",0,str(portal_type))
#LOG("Get Acquired Property base_category",0,str(base_category))
#super_list = self._getValueList(base_category, portal_type=portal_type) # We only do a single jump #super_list = self._getValueList(base_category, portal_type=portal_type) # We only do a single jump
super_list = self._getAcquiredValueList(base_category, portal_type=portal_type) # We only do a single jump super_list = self._getAcquiredValueList(base_category, portal_type=portal_type) # We only do a single jump
super_list = filter(lambda o: o.getPhysicalPath() != self.getPhysicalPath(), super_list) # Make sure we do not create stupid loop here super_list = filter(lambda o: o.getPhysicalPath() != self.getPhysicalPath(), super_list) # Make sure we do not create stupid loop here
...@@ -354,7 +356,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana ...@@ -354,7 +356,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana
return self.getProperty('%s_list' % key) return self.getProperty('%s_list' % key)
security.declareProtected( Permissions.ModifyPortalContent, 'setProperty' ) security.declareProtected( Permissions.ModifyPortalContent, 'setProperty' )
def setProperty(self, key, value, type='string'): def setProperty(self, key, value, type='string', **kw):
""" """
Previous Name: setValue Previous Name: setValue
...@@ -365,15 +367,17 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana ...@@ -365,15 +367,17 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana
Generic accessor. Calls the real accessor Generic accessor. Calls the real accessor
""" """
self._setProperty(key,value,type=type) self._setProperty(key,value,type=type, **kw)
self.reindexObject() self.reindexObject()
security.declareProtected( Permissions.ModifyPortalContent, '_setProperty' ) security.declareProtected( Permissions.ModifyPortalContent, '_setProperty' )
def _setProperty(self, key, value, type='string'): def _setProperty(self, key, value, type='string', **kw):
""" """
Previous Name: _setValue Previous Name: _setValue
Generic accessor. Calls the real accessor Generic accessor. Calls the real accessor
**kw allows to call setProperty as a generic setter (ex. setProperty(value_uid, portal_type=))
""" """
#LOG('In _setProperty',0, str(key)) #LOG('In _setProperty',0, str(key))
if type is not 'string': # Speed if type is not 'string': # Speed
...@@ -387,7 +391,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana ...@@ -387,7 +391,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana
if hasattr(aq_self, accessor_name): if hasattr(aq_self, accessor_name):
#LOG("Calling: ",0, '%s %s ' % (accessor_name, kw[key])) #LOG("Calling: ",0, '%s %s ' % (accessor_name, kw[key]))
method = getattr(self, accessor_name) method = getattr(self, accessor_name)
return method(value) return method(value, **kw)
"""# Make sure we change the default value again """# Make sure we change the default value again
# if it was provided at the same time # if it was provided at the same time
new_key = 'default_%s' % key new_key = 'default_%s' % key
...@@ -400,7 +404,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana ...@@ -400,7 +404,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana
if hasattr(aq_self, public_accessor_name): if hasattr(aq_self, public_accessor_name):
#LOG("Calling: ",0, '%s %s ' % (public_accessor_name, kw[key])) #LOG("Calling: ",0, '%s %s ' % (public_accessor_name, kw[key]))
method = getattr(self, public_accessor_name) method = getattr(self, public_accessor_name)
method(value) method(value, **kw)
else: else:
#LOG("Changing attr: ",0, key) #LOG("Changing attr: ",0, key)
try: try:
...@@ -1142,7 +1146,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana ...@@ -1142,7 +1146,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana
# return [] # return []
security.declareProtected(Permissions.ModifyPortalContent, 'immediateReindexObject') security.declarePublic('immediateReindexObject')
def immediateReindexObject(self, *args, **kw): def immediateReindexObject(self, *args, **kw):
""" """
Reindexes an object - also useful for testing Reindexes an object - also useful for testing
...@@ -1154,10 +1158,10 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana ...@@ -1154,10 +1158,10 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana
pass pass
#LOG("No reindex now",0,self.getRelativeUrl()) #LOG("No reindex now",0,self.getRelativeUrl())
security.declareProtected(Permissions.ModifyPortalContent, 'recursiveImmediateReindexObject') security.declarePublic('recursiveImmediateReindexObject')
recursiveImmediateReindexObject = immediateReindexObject recursiveImmediateReindexObject = immediateReindexObject
security.declareProtected(Permissions.ModifyPortalContent, 'reindexObject') security.declarePublic('reindexObject')
def reindexObject(self, *args, **kw): def reindexObject(self, *args, **kw):
""" """
Reindexes an object Reindexes an object
......
...@@ -427,7 +427,7 @@ be a problem).""" ...@@ -427,7 +427,7 @@ be a problem)."""
# Catalog related # Catalog related
security.declareProtected( Permissions.ModifyPortalContent, 'reindexObject' ) security.declarePublic( 'reindexObject' )
def reindexObject(self, idxs=[]): def reindexObject(self, idxs=[]):
""" """
Fixes the hierarchy structure (use of Base class) Fixes the hierarchy structure (use of Base class)
...@@ -436,7 +436,7 @@ be a problem).""" ...@@ -436,7 +436,7 @@ be a problem)."""
""" """
return Base.reindexObject(self) return Base.reindexObject(self)
security.declareProtected( Permissions.ModifyPortalContent, 'recursiveReindexObject' ) security.declarePublic( 'recursiveReindexObject' )
def recursiveReindexObject(self): def recursiveReindexObject(self):
""" """
Fixes the hierarchy structure (use of Base class) Fixes the hierarchy structure (use of Base class)
...@@ -445,6 +445,7 @@ be a problem).""" ...@@ -445,6 +445,7 @@ be a problem)."""
""" """
self.activate().recursiveImmediateReindexObject() self.activate().recursiveImmediateReindexObject()
security.declarePublic( 'recursiveImmediateReindexObject' )
def recursiveImmediateReindexObject(self): def recursiveImmediateReindexObject(self):
""" """
Applies immediateReindexObject recursively Applies immediateReindexObject recursively
......
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