From 17a597b9d8d23206b26c0939531a8078a258dd72 Mon Sep 17 00:00:00 2001 From: Fabien Morin <fabien@nexedi.com> Date: Thu, 25 Jun 2009 07:43:44 +0000 Subject: [PATCH] version is now catalogued and cmp is performance killer so use sorting from the catalog. Thanks to Kazuhico for his review git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27794 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/TradeCondition.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/product/ERP5/Document/TradeCondition.py b/product/ERP5/Document/TradeCondition.py index 4afa8df4c4..cafe25f242 100644 --- a/product/ERP5/Document/TradeCondition.py +++ b/product/ERP5/Document/TradeCondition.py @@ -357,12 +357,8 @@ class TradeCondition(Path, Transformation, XMLMatrix): effective_model_list = [] model_object_list = [result.getObject() for result in \ self.portal_catalog(portal_type=self.portal_type, - reference=reference,)] - #sort_on=(('version','descending'),))] - # XXX currently, version is not catalogued, so sort using python - def sortByVersion(a, b): - return cmp(b.getVersion(), a.getVersion()) - model_object_list.sort(sortByVersion) + reference=reference, + sort_on=(('version','descending'),))] # if there is model which has effective period containing # the start_date and the stop date of the paysheet, return it -- 2.30.9