Commit 34e72a41 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Jérome Perrin

py2/py3: use OrderableKey in BuilderMixin to support sort with None and int etc.

parent cf0bdbc8
...@@ -36,6 +36,7 @@ from erp5.component.document.Amount import Amount ...@@ -36,6 +36,7 @@ from erp5.component.document.Amount import Amount
from erp5.component.module.MovementGroup import MovementGroupNode from erp5.component.module.MovementGroup import MovementGroupNode
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
from Products.ERP5Type.Utils import OrderableKey
from erp5.component.module.ExplanationCache import _getExplanationCache from erp5.component.module.ExplanationCache import _getExplanationCache
from DateTime import DateTime from DateTime import DateTime
from Acquisition import aq_parent, aq_inner from Acquisition import aq_parent, aq_inner
...@@ -785,8 +786,8 @@ class BuilderMixin(XMLObject, Amount, Predicate): ...@@ -785,8 +786,8 @@ class BuilderMixin(XMLObject, Amount, Predicate):
def sort_movement_group_key(a): def sort_movement_group_key(a):
return ( return (
category_index_dict.get(a.getCollectOrderGroup()), OrderableKey(category_index_dict.get(a.getCollectOrderGroup())),
a.getIntIndex(), OrderableKey(a.getIntIndex()),
) )
if portal_type is None: if portal_type is None:
portal_type = self.getPortalMovementGroupTypeList() portal_type = self.getPortalMovementGroupTypeList()
......
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