From 2774b28b2db81d982fb0fcb035e42fdd86d06c0f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Wed, 4 Nov 2009 10:55:43 +0000
Subject: [PATCH] set reference on accounts and tests sorting / searching by
 account reference

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30284 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../PathTemplateItem/account_module/bank.xml  |   4 +
 .../account_module/collected_vat.xml          |   4 +
 .../account_module/equity.xml                 |   4 +
 .../account_module/fixed_assets.xml           |   4 +
 .../account_module/goods_purchase.xml         |   4 +
 .../account_module/goods_sales.xml            |   4 +
 .../account_module/payable.xml                |   4 +
 .../account_module/receivable.xml             |   4 +
 .../account_module/refundable_vat.xml         |   4 +
 .../account_module/stocks.xml                 |   4 +
 ...ferred_gap_id_as_reference_column.html.xml | 211 ++++++++++++++++++
 .../AccountingZuite_reset.xml                 |   1 +
 ...ingZuite_setAccountReferencePreference.xml | 126 +++++++++++
 bt5/erp5_accounting_ui_test/bt/revision       |   2 +-
 14 files changed, 379 insertions(+), 1 deletion(-)
 create mode 100644 bt5/erp5_accounting_ui_test/PathTemplateItem/portal_tests/accounting_zuite/test_account_module/test_account_module_preferred_gap_id_as_reference_column.html.xml
 create mode 100644 bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_setAccountReferencePreference.xml

diff --git a/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/bank.xml b/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/bank.xml
index cc901462bdb..916f20fffeb 100644
--- a/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/bank.xml
+++ b/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/bank.xml
@@ -84,6 +84,10 @@
               </tuple>
             </value>
         </item>
+        <item>
+            <key> <string>default_reference</string> </key>
+            <value> <string>A-BANK</string> </value>
+        </item>
         <item>
             <key> <string>description</string> </key>
             <value>
diff --git a/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/collected_vat.xml b/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/collected_vat.xml
index 87fccdf9507..da4eade4c97 100644
--- a/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/collected_vat.xml
+++ b/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/collected_vat.xml
@@ -84,6 +84,10 @@
               </tuple>
             </value>
         </item>
+        <item>
+            <key> <string>default_reference</string> </key>
+            <value> <string>A-COLLECTED-VAT</string> </value>
+        </item>
         <item>
             <key> <string>description</string> </key>
             <value>
diff --git a/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/equity.xml b/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/equity.xml
index 7fb87e57595..70426ccabb0 100644
--- a/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/equity.xml
+++ b/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/equity.xml
@@ -84,6 +84,10 @@
               </tuple>
             </value>
         </item>
+        <item>
+            <key> <string>default_reference</string> </key>
+            <value> <string>A-EQUITY</string> </value>
+        </item>
         <item>
             <key> <string>description</string> </key>
             <value>
diff --git a/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/fixed_assets.xml b/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/fixed_assets.xml
index 79e212514f8..d3fc0a354d4 100644
--- a/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/fixed_assets.xml
+++ b/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/fixed_assets.xml
@@ -84,6 +84,10 @@
               </tuple>
             </value>
         </item>
+        <item>
+            <key> <string>default_reference</string> </key>
+            <value> <string>A-FIX-ASSETS</string> </value>
+        </item>
         <item>
             <key> <string>description</string> </key>
             <value>
diff --git a/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/goods_purchase.xml b/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/goods_purchase.xml
index 003db25bc00..0fad9918bb9 100644
--- a/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/goods_purchase.xml
+++ b/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/goods_purchase.xml
@@ -84,6 +84,10 @@
               </tuple>
             </value>
         </item>
+        <item>
+            <key> <string>default_reference</string> </key>
+            <value> <string>A-GP</string> </value>
+        </item>
         <item>
             <key> <string>description</string> </key>
             <value>
diff --git a/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/goods_sales.xml b/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/goods_sales.xml
index 8e5b59e35fb..ff6c0aca867 100644
--- a/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/goods_sales.xml
+++ b/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/goods_sales.xml
@@ -84,6 +84,10 @@
               </tuple>
             </value>
         </item>
+        <item>
+            <key> <string>default_reference</string> </key>
+            <value> <string>A-GS</string> </value>
+        </item>
         <item>
             <key> <string>description</string> </key>
             <value>
diff --git a/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/payable.xml b/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/payable.xml
index dd4c9d37d6f..d2c764101fe 100644
--- a/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/payable.xml
+++ b/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/payable.xml
@@ -84,6 +84,10 @@
               </tuple>
             </value>
         </item>
+        <item>
+            <key> <string>default_reference</string> </key>
+            <value> <string>A-PAY</string> </value>
+        </item>
         <item>
             <key> <string>description</string> </key>
             <value>
diff --git a/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/receivable.xml b/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/receivable.xml
index c6919fe3e23..41157e92e90 100644
--- a/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/receivable.xml
+++ b/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/receivable.xml
@@ -84,6 +84,10 @@
               </tuple>
             </value>
         </item>
+        <item>
+            <key> <string>default_reference</string> </key>
+            <value> <string>A-REC</string> </value>
+        </item>
         <item>
             <key> <string>description</string> </key>
             <value>
diff --git a/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/refundable_vat.xml b/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/refundable_vat.xml
index ed4be90fd9b..5fd6117df10 100644
--- a/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/refundable_vat.xml
+++ b/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/refundable_vat.xml
@@ -84,6 +84,10 @@
               </tuple>
             </value>
         </item>
+        <item>
+            <key> <string>default_reference</string> </key>
+            <value> <string>A-REF-VAT</string> </value>
+        </item>
         <item>
             <key> <string>description</string> </key>
             <value>
diff --git a/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/stocks.xml b/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/stocks.xml
index 060a45e0c52..5cdddc09d67 100644
--- a/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/stocks.xml
+++ b/bt5/erp5_accounting_ui_test/PathTemplateItem/account_module/stocks.xml
@@ -84,6 +84,10 @@
               </tuple>
             </value>
         </item>
+        <item>
+            <key> <string>default_reference</string> </key>
+            <value> <string>A-STOCK</string> </value>
+        </item>
         <item>
             <key> <string>description</string> </key>
             <value>
diff --git a/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_tests/accounting_zuite/test_account_module/test_account_module_preferred_gap_id_as_reference_column.html.xml b/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_tests/accounting_zuite/test_account_module/test_account_module_preferred_gap_id_as_reference_column.html.xml
new file mode 100644
index 00000000000..18049d5b957
--- /dev/null
+++ b/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_tests/accounting_zuite/test_account_module/test_account_module_preferred_gap_id_as_reference_column.html.xml
@@ -0,0 +1,211 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_bind_names</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>_asgns</string> </key>
+                        <value>
+                          <dictionary>
+                            <item>
+                                <key> <string>name_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string encoding="cdata"><![CDATA[
+
+<html>\n
+<head><title>Test for Account module main lisbox</title></head>\n
+<body>\n
+<table cellpadding="1" cellspacing="1" border="1">\n
+<thead>\n
+<tr><td rowspan="1" colspan="4">\n
+Test `preferred_gap_id` column of Account Module\n
+</td></tr>\n
+</thead><tbody tal:define="init_method string:AccountingZuite_createAccountingTransactionList">\n
+<tal:block metal:use-macro="here/AccountingZuite_CommonTemplate/macros/init"/>\n
+\n
+<!-- Setup {{{ -->\n
+<tr>\n
+  <td>open</td>\n
+  <td>${base_url}/AccountingZuite_setAccountReferencePreference</td>\n
+  <td></td>\n
+</tr>\n
+<tr>\n
+  <td>verifyTextPresent</td>\n
+  <td>Preference Set</td>\n
+  <td></td>\n
+</tr>\n
+<tr>\n
+  <td>open</td>\n
+  <td>${base_url}</td>\n
+  <td></td>\n
+</tr>\n
+\n
+<tr>\n
+  <td>selectAndWait</td>\n
+  <td>select_module</td>\n
+  <td>Accounts</td>\n
+</tr>\n
+<!-- }}} -->\n
+\n
+<!-- 10 accounts -> 10 records in the list {{{ -->\n
+<tr>\n
+  <td>clickAndWait</td>\n
+  <td>Folder_show:method</td>\n
+  <td></td>\n
+</tr>\n
+<tr>\n
+  <td>verifyText</td>\n
+  <td>listbox_record_number</td>\n
+  <td>10 records</td>\n
+</tr>\n
+<!-- }}} -->\n
+\n
+<!-- Filter on preferred_gap_id {{{ -->\n
+<tr>\n
+  <td>type</td>\n
+  <td>//tr[@id=\'listbox_search_line\']/td[2]/span/input</td>\n
+  <td>A-STOCK</td>\n
+</tr>\n
+<tr>\n
+  <td>clickAndWait</td>\n
+  <td>Base_doSelect:method</td>\n
+  <td></td>\n
+</tr>\n
+<tr>\n
+  <td>verifyText</td>\n
+  <td>listbox_record_number</td>\n
+  <td>1 records</td>\n
+</tr>\n
+\n
+<tr>\n
+  <td>type</td>\n
+  <td>//tr[@id=\'listbox_search_line\']/td[2]/span/input</td>\n
+  <td></td>\n
+</tr>\n
+<tr>\n
+  <td>clickAndWait</td>\n
+  <td>Base_doSelect:method</td>\n
+  <td></td>\n
+</tr>\n
+<tr>\n
+  <td>verifyText</td>\n
+  <td>listbox_record_number</td>\n
+  <td>10 records</td>\n
+</tr>\n
+\n
+\n
+\n
+<!-- make sure we are sorted by preferred_gap_id ASC -->\n
+<tr>\n
+  <!-- sort by title, to reset any sort on preferred_gap_id -->\n
+  <td>clickAndWait</td>\n
+  <td>//button[@title=\'Account Name\']</td>\n
+  <td></td>\n
+</tr>\n
+<tr>\n
+  <!-- sort by preferred_gap_id -->\n
+  <td>clickAndWait</td>\n
+  <td>//button[@title=\'GAP Number\']</td>\n
+  <td></td>\n
+</tr>\n
+<tr>\n
+  <td>verifyText</td>\n
+  <td>//tr[@id=\'listbox_data_line_0\']/td[2]/a</td>\n
+  <td>A-BANK</td>\n
+</tr>\n
+<tr>\n
+  <td>verifyText</td>\n
+  <td>//tr[@id=\'listbox_data_line_1\']/td[2]/a</td>\n
+  <td>A-COLLECTED-VAT</td>\n
+</tr>\n
+<tr>\n
+  <td>verifyText</td>\n
+  <td>//tr[@id=\'listbox_data_line_2\']/td[2]/a</td>\n
+  <td>A-EQUITY</td>\n
+</tr>\n
+<!-- }}} -->\n
+\n
+<!-- sort by preferred_gap_id DESC {{{ -->\n
+<tr>\n
+  <!-- sort by preferred_gap_id -->\n
+  <td>clickAndWait</td>\n
+  <td>//button[@title=\'GAP Number\']</td>\n
+  <td></td>\n
+</tr>\n
+<tr>\n
+  <td>verifyText</td>\n
+  <td>//tr[@id=\'listbox_data_line_0\']/td[2]/a</td>\n
+  <td>A-STOCK</td>\n
+</tr>\n
+<tr>\n
+  <td>verifyText</td>\n
+  <td>//tr[@id=\'listbox_data_line_1\']/td[2]/a</td>\n
+  <td>A-REF-VAT</td>\n
+</tr>\n
+<tr>\n
+  <td>verifyText</td>\n
+  <td>//tr[@id=\'listbox_data_line_2\']/td[2]/a</td>\n
+  <td>A-REC</td>\n
+</tr>\n
+<tr>\n
+  <td>verifyText</td>\n
+  <td>//tr[@id=\'listbox_data_line_3\']/td[2]/a</td>\n
+  <td>A-PAY</td>\n
+</tr>\n
+<!-- }}} -->\n
+\n
+</tbody></table>\n
+</body>\n
+</html> <!-- vim: syntax=html foldmethod=marker\n
+-->\n
+
+
+]]></string> </value>
+        </item>
+        <item>
+            <key> <string>content_type</string> </key>
+            <value> <string>text/html</string> </value>
+        </item>
+        <item>
+            <key> <string>expand</string> </key>
+            <value> <int>0</int> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>test_account_module_preferred_gap_id_as_reference_column.html</string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_reset.xml b/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_reset.xml
index f6ccef60100..c791d5e37c9 100644
--- a/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_reset.xml
+++ b/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_reset.xml
@@ -86,6 +86,7 @@ if pref.owner_info()[\'id\'] != str(context.REQUEST.AUTHENTICATED_USER):\n
   ptool.manage_pasteObjects(cb)\n
 pref.edit(preferred_accounting_transaction_at_date=None)\n
 pref.edit(preferred_accounting_transaction_from_date=None)\n
+pref.edit(preferred_account_number_method=None)\n
 if pref.getPreferenceState() == \'disabled\':\n
   pref.enable()\n
 \n
diff --git a/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_setAccountReferencePreference.xml b/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_setAccountReferencePreference.xml
new file mode 100644
index 00000000000..fb3c66d838c
--- /dev/null
+++ b/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_setAccountReferencePreference.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <item>
+            <key> <string>_bind_names</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>_asgns</string> </key>
+                        <value>
+                          <dictionary>
+                            <item>
+                                <key> <string>name_container</string> </key>
+                                <value> <string>container</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_context</string> </key>
+                                <value> <string>context</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_m_self</string> </key>
+                                <value> <string>script</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_body</string> </key>
+            <value> <string>preference = context.portal_preferences.accounting_zuite_preference\n
+preference.edit(preferred_account_number_method=\'account_reference\')\n
+\n
+return "Preference Set"\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>errors</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_code</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>co_argcount</string> </key>
+                        <value> <int>0</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>preference</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>AccountingZuite_setAccountReferencePreference</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_accounting_ui_test/bt/revision b/bt5/erp5_accounting_ui_test/bt/revision
index b5db9c417a2..acfba60953b 100644
--- a/bt5/erp5_accounting_ui_test/bt/revision
+++ b/bt5/erp5_accounting_ui_test/bt/revision
@@ -1 +1 @@
-139
\ No newline at end of file
+141
\ No newline at end of file
-- 
2.30.9