diff --git a/product/ERP5/Document/AccountingTransaction.py b/product/ERP5/Document/AccountingTransaction.py index 752a816991438885eea6a4ab75b2d671499dc323..7fd0d6f503ed4e2b67fa9953792b7704b112bc67 100755 --- a/product/ERP5/Document/AccountingTransaction.py +++ b/product/ERP5/Document/AccountingTransaction.py @@ -29,6 +29,7 @@ from Globals import InitializeClass, PersistentMapping from AccessControl import ClassSecurityInfo from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface +from Products.CMFCore.utils import getToolByName from Products.ERP5.Document.Delivery import Delivery @@ -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 ) diff --git a/product/ERP5/Document/AppliedRule.py b/product/ERP5/Document/AppliedRule.py index 5c322d44c2f62bba12d041feab240493fabe082a..0f9028e579b222f00e235d815f76a77e4add7d30 100755 --- a/product/ERP5/Document/AppliedRule.py +++ b/product/ERP5/Document/AppliedRule.py @@ -262,7 +262,7 @@ An ERP5 Rule...""" result.extend(m.getMovementIndex()) return result - security.declareProtected(Permissions.View, 'reindexObject') + security.declarePublic('reindexObject') def reindexObject(self, **kw): """ Only reindex root applied rule diff --git a/product/ERP5/Document/Capacity.py b/product/ERP5/Document/Capacity.py index 5c8fe4f39b617ff39d9bf6ce58b62243fcb4caeb..a7b21b5e62d0aac00d47e1d331f1c3ce3121b3fd 100755 --- a/product/ERP5/Document/Capacity.py +++ b/product/ERP5/Document/Capacity.py @@ -53,7 +53,7 @@ class Capacity(XMLObject): pass - security.declareProtected(Permissions.ModifyPortalContent, 'reindexObject') + security.declarePublic('reindexObject') def reindexObject(self): """ Overload reindexing in order to forward any modifications of capacity diff --git a/product/ERP5/Document/SimulationMovement.py b/product/ERP5/Document/SimulationMovement.py index 5131ef2e58043bd3c6bdcc72620edd5eca3a4b2a..7dc9a042e13361b839b9284116502fb87c3bf938 100755 --- a/product/ERP5/Document/SimulationMovement.py +++ b/product/ERP5/Document/SimulationMovement.py @@ -348,7 +348,7 @@ a service in a public administration).""" """ return self.getRootAppliedRule().hasActivity(**kw) - security.declareProtected(Permissions.View, 'reindexObject') + security.declarePublic('reindexObject') def reindexObject(self, **kw): """ We reindex the whole applied rule (only once) diff --git a/product/ERP5Type/Base.py b/product/ERP5Type/Base.py index 45d7307a09c848f81923127c77a59f9f13067259..65821833159d7449c7e5344abd3212b751d644bf 100755 --- a/product/ERP5Type/Base.py +++ b/product/ERP5Type/Base.py @@ -196,7 +196,9 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana if getattr(self, storage_id) != None: return getattr(self, storage_id) # 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 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._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 @@ -354,7 +356,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana return self.getProperty('%s_list' % key) security.declareProtected( Permissions.ModifyPortalContent, 'setProperty' ) - def setProperty(self, key, value, type='string'): + def setProperty(self, key, value, type='string', **kw): """ Previous Name: setValue @@ -365,15 +367,17 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana Generic accessor. Calls the real accessor """ - self._setProperty(key,value,type=type) + self._setProperty(key,value,type=type, **kw) self.reindexObject() security.declareProtected( Permissions.ModifyPortalContent, '_setProperty' ) - def _setProperty(self, key, value, type='string'): + def _setProperty(self, key, value, type='string', **kw): """ Previous Name: _setValue 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)) if type is not 'string': # Speed @@ -387,7 +391,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana if hasattr(aq_self, accessor_name): #LOG("Calling: ",0, '%s %s ' % (accessor_name, kw[key])) method = getattr(self, accessor_name) - return method(value) + return method(value, **kw) """# Make sure we change the default value again # if it was provided at the same time new_key = 'default_%s' % key @@ -400,7 +404,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana if hasattr(aq_self, public_accessor_name): #LOG("Calling: ",0, '%s %s ' % (public_accessor_name, kw[key])) method = getattr(self, public_accessor_name) - method(value) + method(value, **kw) else: #LOG("Changing attr: ",0, key) try: @@ -501,7 +505,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana new_relative_url = self.getRelativeUrl() if reindex: self.flushActivity(invoke=1) # Required if we wish that news ids appear instantly self.activate().updateRelatedContent(previous_relative_url, new_relative_url) - + security.declareProtected( Permissions.ModifyPortalContent, 'updateRelatedContent' ) def updateRelatedContent(self, previous_category_url, new_category_url): """ @@ -1142,7 +1146,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana # return [] - security.declareProtected(Permissions.ModifyPortalContent, 'immediateReindexObject') + security.declarePublic('immediateReindexObject') def immediateReindexObject(self, *args, **kw): """ Reindexes an object - also useful for testing @@ -1154,10 +1158,10 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana pass #LOG("No reindex now",0,self.getRelativeUrl()) - security.declareProtected(Permissions.ModifyPortalContent, 'recursiveImmediateReindexObject') + security.declarePublic('recursiveImmediateReindexObject') recursiveImmediateReindexObject = immediateReindexObject - security.declareProtected(Permissions.ModifyPortalContent, 'reindexObject') + security.declarePublic('reindexObject') def reindexObject(self, *args, **kw): """ Reindexes an object @@ -1283,7 +1287,7 @@ class TempBase(Base): return self def setUid(self, value): - self.uid = value # Required for Listbox so that no casting happens when we use TempBase to create new objects + self.uid = value # Required for Listbox so that no casting happens when we use TempBase to create new objects InitializeClass(Base) diff --git a/product/ERP5Type/Document/Folder.py b/product/ERP5Type/Document/Folder.py index c835f47a35c52c77c2b7995b25d4e397949cf7bd..6842cfbcd19479835f6cc5025d93025814cfc00d 100755 --- a/product/ERP5Type/Document/Folder.py +++ b/product/ERP5Type/Document/Folder.py @@ -427,7 +427,7 @@ be a problem).""" # Catalog related - security.declareProtected( Permissions.ModifyPortalContent, 'reindexObject' ) + security.declarePublic( 'reindexObject' ) def reindexObject(self, idxs=[]): """ Fixes the hierarchy structure (use of Base class) @@ -436,7 +436,7 @@ be a problem).""" """ return Base.reindexObject(self) - security.declareProtected( Permissions.ModifyPortalContent, 'recursiveReindexObject' ) + security.declarePublic( 'recursiveReindexObject' ) def recursiveReindexObject(self): """ Fixes the hierarchy structure (use of Base class) @@ -445,6 +445,7 @@ be a problem).""" """ self.activate().recursiveImmediateReindexObject() + security.declarePublic( 'recursiveImmediateReindexObject' ) def recursiveImmediateReindexObject(self): """ Applies immediateReindexObject recursively