diff --git a/product/ERP5/bootstrap/erp5_core/CategoryTemplateItem/portal_categories/destination.xml b/product/ERP5/bootstrap/erp5_core/CategoryTemplateItem/portal_categories/destination.xml index 0c1242936795b6c680b840531b6996e0d4c9bcd6..43a1e4efcb7e907683f7a8f0f00e96dcf599342e 100644 --- a/product/ERP5/bootstrap/erp5_core/CategoryTemplateItem/portal_categories/destination.xml +++ b/product/ERP5/bootstrap/erp5_core/CategoryTemplateItem/portal_categories/destination.xml @@ -32,6 +32,8 @@ <key> <string>acquisition_base_category</string> </key> <value> <tuple> + <string>order</string> + <string>parent</string> </tuple> </value> </item> @@ -51,7 +53,7 @@ </item> <item> <key> <string>acquisition_portal_type</string> </key> - <value> <string>python: []</string> </value> + <value> <string>python: list( portal.getPortalAcquisitionMovementTypeList() + portal.getPortalItemTypeList() + portal.getPortalDeliveryTypeList() + portal.getPortalOrderTypeList() + portal.getPortalInvoiceTypeList() + portal.getPortalSupplyTypeList() + portal.getPortalSupplyPathTypeList() + portal.getPortalProjectTypeList() + portal.getPortalOpenOrderTypeList() + portal.getPortalCalendarTypeList())</string> </value> </item> <item> <key> <string>acquisition_sync_value</string> </key> diff --git a/product/ERP5Workflow/Document/Interaction.py b/product/ERP5Workflow/Document/Interaction.py index 554a12d8fb105d3ed2d9458893a4499051677eb3..305d5c8688c2c6b77e342600231e7f1925270fcc 100644 --- a/product/ERP5Workflow/Document/Interaction.py +++ b/product/ERP5Workflow/Document/Interaction.py @@ -114,4 +114,24 @@ class Interaction(IdAsReferenceMixin('interaction_', "prefix"), XMLObject, """ parent = self.getParentValue() return [parent._getOb(transition_id) for transition_id - in self.getActivateScriptIdList()] \ No newline at end of file + in self.getActivateScriptIdList()] + + # XXX(PERF): hack to see Category Tool responsability in new workflow slowness + security.declareProtected(Permissions.AccessContentsInformation, + 'getActivateScriptList') + def getActivateScriptList(self): + """ + returns the list of activate script + """ + return [path.split('/')[-1] for path in self.getCategoryList() + if path.startswith('activate_script')] + + # XXX(PERF): hack to see Category Tool responsability in new workflow slowness + security.declareProtected(Permissions.AccessContentsInformation, + 'getBeforeCommitScriptList') + def getBeforeCommitScriptList(self): + """ + returns the list of before commit script + """ + return [path.split('/')[-1] for path in self.getCategoryList() + if path.startswith('before_commit_script')] \ No newline at end of file diff --git a/product/ERP5Workflow/Document/State.py b/product/ERP5Workflow/Document/State.py index 7bc94b8e2d723f75680840ffd23259d60459884f..40e8910707d42d2d333536e3d55d94a4677ea259 100644 --- a/product/ERP5Workflow/Document/State.py +++ b/product/ERP5Workflow/Document/State.py @@ -90,6 +90,19 @@ class State(IdAsReferenceMixin("state_", "prefix"), XMLObject, CustomStorageMatr possible_transition_list.append(tr_path) self.setCategoryList(possible_transition_list) + + # XXX(PERF): hack to see Category Tool responsability in new workflow slowness + security.declareProtected(Permissions.AccessContentsInformation, + 'getDestinationList') + def getDestinationList(self): + """ + this getter is redefined to improve performance: + instead of getting all the transition objects from the destination list + to then use their ids, extract the information from the string + """ + return [path.split('/')[-1] for path in self.getCategoryList() if path.startswith('destination')] + + security.declareProtected(Permissions.AccessContentsInformation, 'getDestinationIdList') def getDestinationIdList(self): @@ -100,6 +113,8 @@ class State(IdAsReferenceMixin("state_", "prefix"), XMLObject, CustomStorageMatr """ return [path.split('/')[-1] for path in self.getDestinationList()] + security.declareProtected(Permissions.AccessContentsInformation, + 'getDestinationValueList') def getDestinationValueList(self): """ this getter is redefined to improve performance: diff --git a/product/ERP5Workflow/Document/Transition.py b/product/ERP5Workflow/Document/Transition.py index 0ff265a010653cd5a17d0dc29bdb650e71156458..5b7c09fa783b5d24d39ab3f4a72ac4c8605b0679 100644 --- a/product/ERP5Workflow/Document/Transition.py +++ b/product/ERP5Workflow/Document/Transition.py @@ -82,6 +82,28 @@ class Transition(IdAsReferenceMixin("transition_", "prefix"), XMLObject, # they use the categories paths directly and string operations # instead of traversing from the portal to get the objects # in order to have their id or value + + # XXX(PERF): hack to see Category Tool responsability in new workflow slowness + security.declareProtected(Permissions.AccessContentsInformation, + 'getBeforeScriptList') + def getBeforeScriptList(self): + """ + returns the list of before script + """ + return [path.split('/')[-1] for path in self.getCategoryList() + if path.startswith('before_script')] + + # XXX(PERF): hack to see Category Tool responsability in new workflow slowness + security.declareProtected(Permissions.AccessContentsInformation, + 'getAfterScriptList') + def getAfterScriptList(self): + """ + returns the list of after script + """ + return [path.split('/')[-1] for path in self.getCategoryList() + if path.startswith('after_script')] + + security.declareProtected(Permissions.AccessContentsInformation, 'getBeforeScriptIdList') def getBeforeScriptIdList(self): @@ -116,4 +138,4 @@ class Transition(IdAsReferenceMixin("transition_", "prefix"), XMLObject, """ parent = self.getParentValue() return [parent._getOb(transition_id) for transition_id - in self.getAfterScriptIdList()] \ No newline at end of file + in self.getAfterScriptIdList()]