From bfb25bb361fb74eb8d1a86c166803a1b4ca45b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Mon, 12 Apr 2010 13:34:08 +0000 Subject: [PATCH] sort lines properly git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34466 20353a03-c40f-0410-a6d1-a30d3c3de9de --- ...ction_getAccountingTransactionLineList.xml | 20 +++++++++---------- bt5/erp5_accounting/bt/revision | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getAccountingTransactionLineList.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getAccountingTransactionLineList.xml index 1b5520d19b..4db39185b9 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getAccountingTransactionLineList.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getAccountingTransactionLineList.xml @@ -53,21 +53,19 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>sort_dict = { \'income\': \'\\0\\0\',\n - \'expense\': \'\\0\\0\',\n - \'receivable\': \'\\0\\2\',\n - \'payable\': \'\\0\\2\',\n - \'collected_vat\': \'\\0\\1\',\n - \'refundable_vat\': \'\\0\\1\' }\n + <value> <string>sort_dict = { \'income\': 0,\n + \'expense\': -2,\n + \'receivable\': -2,\n + \'payable\': 0,\n + \'collected_vat\': -1,\n + \'refundable_vat\': -1 }\n \n -def sortInvoiceTransactionLine(a, b):\n - a_id = sort_dict.get(a.getId(), a.getId())\n - b_id = sort_dict.get(b.getId(), b.getId())\n - return cmp(a_id, b_id)\n +def sortInvoiceTransactionLine(a):\n + return sort_dict.get(a.getId(), a.getIntId())\n \n object_list = list(context.contentValues(\n filter={\'portal_type\': portal_type}))\n -object_list.sort(sortInvoiceTransactionLine)\n +object_list.sort(key=sortInvoiceTransactionLine)\n return object_list\n </string> </value> </item> diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision index 8535dde961..d5e7c400bc 100644 --- a/bt5/erp5_accounting/bt/revision +++ b/bt5/erp5_accounting/bt/revision @@ -1 +1 @@ -1161 \ No newline at end of file +1162 \ No newline at end of file -- 2.30.9