From 77341a89db3c357a0b30eaf32d50601c8b4432ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Wed, 10 Apr 2013 14:56:01 +0200
Subject: [PATCH] Support runnning on an instance configured for SMB

---
 ...gZuite_createAccountingTransactionList.xml | 25 +++++++++++--------
 bt5/erp5_accounting_ui_test/bt/revision       |  2 +-
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createAccountingTransactionList.xml b/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createAccountingTransactionList.xml
index 30cc27bac5..21b349b51b 100644
--- a/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createAccountingTransactionList.xml
+++ b/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createAccountingTransactionList.xml
@@ -50,16 +50,22 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>from DateTime import DateTime\n
+            <value> <string encoding="cdata"><![CDATA[
+
+from DateTime import DateTime\n
 \n
 # params\n
 section_title = \'My Organisation\'\n
-business_process = \'business_process_module/erp5_default_business_process\'\n
 portal = context.getPortalObject()\n
 accounting_module = portal.accounting_module\n
 year = 2005\n
 default_date = DateTime(year, 01, 01)\n
 \n
+business_process = portal.portal_catalog.getResultValue(\n
+  reference=(\'default_erp5_business_process\', # erp5_configurator\n
+             \'erp5_default_business_process\'), # erp5_simulation_test\n
+  portal_type=\'Business Process\').getRelativeUrl()\n
+\n
 # if the previous test didn\'t change input data, no need to recreate content\n
 current_script_data_id = \'%s_month_count_%s_draft_%s_state_%s_payment_%s\' % (\n
      month_count, add_draft_transactions, transaction_state,\n
@@ -77,6 +83,8 @@ if 1:\n
                     \'sale_packing_list_module\',\n
                     \'portal_simulation\', ]:\n
     module = portal[module_id]\n
+    if len(module) > 200:\n
+      raise ValueError("Do not run this on production !!!")\n
     module.manage_delObjects(list(module.objectIds()))\n
 \n
 def getAccountByTitle(title):\n
@@ -96,14 +104,7 @@ def getOrganisationByTitle(title):\n
   return document_list[0]\n
 section = getOrganisationByTitle(section_title)\n
 \n
-def getCurrencyByReference(reference):\n
-  document_list = [x.getObject().getRelativeUrl() for x in\n
-    portal.portal_catalog(portal_type=\'Currency\',\n
-                          reference=reference)]\n
-  assert len(document_list) == 1, \\\n
-      \'%d currency with reference "%s"\' % (len(document_list), reference)\n
-  return document_list[0]\n
-euro_resource = getCurrencyByReference(\'EUR\')\n
+euro_resource = \'currency_module/euro\'\n
 \n
 def getBankAccountByTitle(title):\n
   document_list = [x.getObject().getRelativeUrl() for x in\n
@@ -321,7 +322,9 @@ accounting_module.setProperty(\'current_content_script\',\n
 # test depends on this\n
 return "Accounting Transactions Created."\n
 # vim: syntax=python\n
-</string> </value>
+
+
+]]></string> </value>
         </item>
         <item>
             <key> <string>_params</string> </key>
diff --git a/bt5/erp5_accounting_ui_test/bt/revision b/bt5/erp5_accounting_ui_test/bt/revision
index 66321c084c..1a1f7f8270 100644
--- a/bt5/erp5_accounting_ui_test/bt/revision
+++ b/bt5/erp5_accounting_ui_test/bt/revision
@@ -1 +1 @@
-189
\ No newline at end of file
+190
\ No newline at end of file
-- 
2.30.9