From 71bbfdc223aa3f703a9f4f71ef5010c412c02fec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Thu, 27 Apr 2006 16:07:34 +0000 Subject: [PATCH] Improve InvoiceTransactionRule_asCellRange script so that it can guess dimensions. (+commit dummy changes to AccountingTransaction_deleteEmptyLine at the same time) git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6968 20353a03-c40f-0410-a6d1-a30d3c3de9de --- ...AccountingTransaction_deleteEmptyLines.xml | 2 +- .../InvoiceTransactionRule_asCellRange.xml | 30 +++++++++++-------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_deleteEmptyLines.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_deleteEmptyLines.xml index f9c0a18861..4a115a6b93 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_deleteEmptyLines.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_deleteEmptyLines.xml @@ -141,7 +141,7 @@ if redirect:\n <value> <tuple> <string>redirect</string> - <string>Producs.ERP5Type.Message</string> + <string>Products.ERP5Type.Message</string> <string>Message</string> <string>N_</string> <string>_getattr_</string> diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InvoiceTransactionRule_asCellRange.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InvoiceTransactionRule_asCellRange.xml index 8ce67c91f9..565d3a7d35 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InvoiceTransactionRule_asCellRange.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InvoiceTransactionRule_asCellRange.xml @@ -66,12 +66,13 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string># This script should be smart enough to guess what to use for lines, columns and tabs.\n -# For now, we only statically define it.\n -\n -dimension_list = [\'tax_category\', \'product\', \'region\', \'product_line\',\n + <value> <string>dimension_list = [\'tax_category\', \'product\', \'region\', \'product_line\',\n \'destination_region\', \'has_vat_number\', \'movement\']\n \n +dimension_list.extend([ pred.getStringIndex()\n + for pred in context.objectValues(portal_type=\'Predicate\')\n + if pred.getStringIndex() not in dimension_list ])\n +\n if list_dimensions == 1 :\n return dimension_list\n \n @@ -79,10 +80,9 @@ dimension_result_list = []\n \n for dimension in dimension_list :\n if dimension is not None :\n - predicate_list = context.searchFolder(string_index=dimension, sort_on=\'int_index\')\n + predicate_list = context.searchFolder(string_index=dimension,\n + sort_on=\'int_index\')\n if len(predicate_list):\n - # context.log(\'InvoiceTransactionRule_asCellRance predicate_list %s \' %dimension,\n - # [x.getObject() for x in predicate_list])\n dimension_result_list.append(predicate_list)\n \n \n @@ -90,10 +90,13 @@ dimension_ids_list = []\n \n if matrixbox == 1 :\n for dimension_result in dimension_result_list :\n - dimension_ids_list.append(map(lambda x: (x.getObject().getRelativeUrl(), x.getObject().getTitle()), dimension_result))\n + dimension_ids_list.append(\n + map(lambda x: (x.getObject().getRelativeUrl(),\n + x.getObject().getTitle()), dimension_result))\n else :\n for dimension_result in dimension_result_list :\n - dimension_ids_list.append(map(lambda x: x.getObject().getRelativeUrl(), dimension_result))\n + dimension_ids_list.append(\n + map(lambda x: x.getObject().getRelativeUrl(), dimension_result))\n \n return dimension_ids_list\n # vim: syntax=python\n @@ -147,12 +150,15 @@ return dimension_ids_list\n <string>list_dimensions</string> <string>kw</string> <string>dimension_list</string> - <string>dimension_result_list</string> + <string>_getattr_</string> + <string>append</string> + <string>$append0</string> <string>_getiter_</string> + <string>context</string> + <string>pred</string> + <string>dimension_result_list</string> <string>dimension</string> <string>None</string> - <string>_getattr_</string> - <string>context</string> <string>predicate_list</string> <string>len</string> <string>dimension_ids_list</string> -- 2.30.9