Commit bfb25bb3 authored by Jérome Perrin's avatar Jérome Perrin

sort lines properly

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34466 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ae7673ae
...@@ -53,21 +53,19 @@ ...@@ -53,21 +53,19 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>sort_dict = { \'income\': \'\\0\\0\',\n <value> <string>sort_dict = { \'income\': 0,\n
\'expense\': \'\\0\\0\',\n \'expense\': -2,\n
\'receivable\': \'\\0\\2\',\n \'receivable\': -2,\n
\'payable\': \'\\0\\2\',\n \'payable\': 0,\n
\'collected_vat\': \'\\0\\1\',\n \'collected_vat\': -1,\n
\'refundable_vat\': \'\\0\\1\' }\n \'refundable_vat\': -1 }\n
\n \n
def sortInvoiceTransactionLine(a, b):\n def sortInvoiceTransactionLine(a):\n
a_id = sort_dict.get(a.getId(), a.getId())\n return sort_dict.get(a.getId(), a.getIntId())\n
b_id = sort_dict.get(b.getId(), b.getId())\n
return cmp(a_id, b_id)\n
\n \n
object_list = list(context.contentValues(\n object_list = list(context.contentValues(\n
filter={\'portal_type\': portal_type}))\n filter={\'portal_type\': portal_type}))\n
object_list.sort(sortInvoiceTransactionLine)\n object_list.sort(key=sortInvoiceTransactionLine)\n
return object_list\n return object_list\n
</string> </value> </string> </value>
</item> </item>
......
1161 1162
\ No newline at end of file \ No newline at end of file
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