Commit 706878b9 authored by Julien Muchembled's avatar Julien Muchembled

ERP5Site: minor optimization in some getPortal*TypeList methods

We could go further by changing the API to not cast the result into tuples.
parent 4a204b8e
...@@ -1087,10 +1087,11 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin): ...@@ -1087,10 +1087,11 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
""" """
Return acquisition movement types. Return acquisition movement types.
""" """
return tuple(list(self.getPortalOrderMovementTypeList()) + r = list(self.getPortalOrderMovementTypeList())
list(self.getPortalDeliveryMovementTypeList()) + r += self.getPortalDeliveryMovementTypeList()
list(self.getPortalTaxMovementTypeList()) + r += self.getPortalTaxMovementTypeList()
list(self.getPortalInvoiceMovementTypeList())) r += self.getPortalInvoiceMovementTypeList()
return tuple(r)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getPortalMovementTypeList') 'getPortalMovementTypeList')
...@@ -1098,12 +1099,13 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin): ...@@ -1098,12 +1099,13 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
""" """
Return movement types. Return movement types.
""" """
return tuple(list(self.getPortalOrderMovementTypeList()) + r = list(self.getPortalOrderMovementTypeList())
list(self.getPortalDeliveryMovementTypeList()) + r += self.getPortalDeliveryMovementTypeList()
list(self.getPortalInvoiceMovementTypeList()) + r += self.getPortalInvoiceMovementTypeList()
list(self.getPortalTaxMovementTypeList()) + r += self.getPortalTaxMovementTypeList()
list(self.getPortalAccountingMovementTypeList()) + r += self.getPortalAccountingMovementTypeList()
['Simulation Movement']) r.append('Simulation Movement')
return tuple(r)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getPortalSimulatedMovementTypeList') 'getPortalSimulatedMovementTypeList')
...@@ -1111,8 +1113,9 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin): ...@@ -1111,8 +1113,9 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
""" """
Return simulated movement types. Return simulated movement types.
""" """
return tuple([x for x in self.getPortalMovementTypeList() \ r = set(self.getPortalMovementTypeList())
if x not in self.getPortalContainerTypeList()]) r.difference_update(self.getPortalContainerTypeList())
return tuple(r)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getPortalContainerTypeList') 'getPortalContainerTypeList')
......
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