From 1f2086db4dd455f8fab867b87df0e5385cbb328c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Fri, 11 Aug 2006 17:32:57 +0000
Subject: [PATCH] remove InvoiceTransactionLine_getDestinationItemList and
 InvoiceTransactionLine_getSourceItemList in favor of
 AccountingTransactionLine_getNodeItemList, which fixes source/destination
 inversion on lines ids for Purchase Invoice Transactions.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9163 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../my_account.xml                            |   2 +-
 .../listbox_destination.xml                   |   2 +-
 .../listbox_source.xml                        |   2 +-
 ...ountingTransactionLine_getNodeItemList.xml | 260 ++++++++++++++++++
 .../my_node.xml                               |   2 +-
 .../listbox_source.xml                        |   2 +-
 .../listbox_destination.xml                   |   2 +-
 .../listbox_destination.xml                   |   2 +-
 .../listbox_source.xml                        |   2 +-
 .../listbox_source.xml                        |   2 +-
 .../listbox_source.xml                        |   2 +-
 ...TransactionLine_getDestinationItemList.xml |  19 +-
 ...voiceTransactionLine_getSourceItemList.xml |  64 +----
 .../listbox_source.xml                        |   2 +-
 .../listbox_destination.xml                   |   2 +-
 .../listbox_source.xml                        |   2 +-
 .../PurchaseInvoiceTransaction_init.xml       |   6 +-
 .../listbox_destination.xml                   |   2 +-
 .../listbox_destination.xml                   |   2 +-
 .../listbox_source.xml                        |   2 +-
 .../listbox_destination.xml                   |   2 +-
 .../listbox_source.xml                        |   2 +-
 .../listbox_destination.xml                   |   2 +-
 .../listbox_source.xml                        |   2 +-
 bt5/erp5_accounting/bt/change_log             |   3 +
 25 files changed, 294 insertions(+), 98 deletions(-)
 create mode 100644 bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionLine_getNodeItemList.xml

diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog/my_account.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog/my_account.xml
index 76a8c99211..b075691638 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog/my_account.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog/my_account.xml
@@ -302,7 +302,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:here.InvoiceTransactionLine_getSourceItemList()</string> </value>
+            <value> <string>python:here.AccountingTranscationLine_getNodeItemList()</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingRuleCell_viewDestination/listbox_destination.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingRuleCell_viewDestination/listbox_destination.xml
index edfb443a80..1b96cfeb9a 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingRuleCell_viewDestination/listbox_destination.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingRuleCell_viewDestination/listbox_destination.xml
@@ -281,7 +281,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:cell.getObject().InvoiceTransactionLine_getDestinationItemList()</string> </value>
+            <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList(mirror=1)</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingRuleCell_viewSource/listbox_source.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingRuleCell_viewSource/listbox_source.xml
index f16e7e3397..5a47862c30 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingRuleCell_viewSource/listbox_source.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingRuleCell_viewSource/listbox_source.xml
@@ -281,7 +281,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:cell.getObject().InvoiceTransactionLine_getSourceItemList()</string> </value>
+            <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList()</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionLine_getNodeItemList.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionLine_getNodeItemList.xml
new file mode 100644
index 0000000000..1e634365be
--- /dev/null
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionLine_getNodeItemList.xml
@@ -0,0 +1,260 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Products.PythonScripts.PythonScript</string>
+          <string>PythonScript</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Python_magic</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </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>"""Return item list of accounts that can be used as node for this accounting\n
+transaction line.\n
+The id of the line is used to filter the list. If `mirror` is set to a true\n
+value, the list will be filtered for the mirror node.\n
+"""\n
+from Products.ERP5Type.Cache import CachingMethod\n
+\n
+if not mirror:\n
+  category_dict = {\n
+    \'income\': \'account_type/income\',\n
+    \'expense\': \'account_type/expense\',\n
+    \'payable\': \'account_type/liability/payable\',\n
+    \'receivable\': \'account_type/asset/receivable\',\n
+    \'collected_vat\': \'account_type/liability/payable/collected_vat\',\n
+    \'refundable_vat\': \'account_type/asset/receivable/refundable_vat\',\n
+    \'bank\': \'account_type/asset/cash\',\n
+    \'cash\': \'account_type/asset/cash\', }\n
+else:\n
+   category_dict = {\n
+    \'income\': \'account_type/expense\',\n
+    \'expense\': \'account_type/income\',\n
+    \'payable\': \'account_type/asset/receivable\',\n
+    \'receivable\': \'account_type/liability/payable\',\n
+    \'collected_vat\': \'account_type/asset/receivable/refundable_vat\',\n
+    \'refundable_vat\': \'account_type/liability/payable/collected_vat\',\n
+    \'bank\': \'account_type/asset/cash\',\n
+    \'cash\': \'account_type/asset/cash\', }\n
+\n
+category = category_dict.get(context.getId(), \'account_type\')\n
+\n
+display_cache = {}\n
+display_funct = context.Account_getFormattedTitle\n
+\n
+def display(x):\n
+  if x not in display_cache:\n
+    display_cache[x] = display_funct(x)\n
+  return display_cache[x]\n
+\n
+def sort(x,y):\n
+  return cmp(display(x), display(y))\n
+\n
+def getItemList(category=None, portal_path=None, mirror=0,\n
+                user_name=None, simulation_state=None):\n
+  """Returns a list of Account path items. """\n
+  cat = context.portal_categories.resolveCategory(category)\n
+  filter_dict = {}\n
+\n
+  # we don\'t filter in existing transactions or report / search dialogs\n
+  if simulation_state not in (\'delivered\', \'cancelled\', \'no_simulation_state\'):\n
+    filter_dict[\'validation_state\'] = (\'draft\', \'validated\')\n
+  \n
+  item_list = cat.getCategoryMemberItemList(\n
+                              portal_type=\'Account\',\n
+                              base=0,\n
+                              display_method=display,\n
+                              sort_method=sort,\n
+                              strict_membership=1,\n
+                              filter=filter_dict)\n
+  return item_list\n
+\n
+# wrap the previous method in a cache\n
+getItemList = CachingMethod(getItemList,\n
+                            id=\'AccountingTransactionLine_getNodeItemList\')\n
+\n
+# the cache vary with the simulation state of the current transaction,\n
+# to display all accounts when the transaction is already delivered.\n
+return getItemList( category=category,\n
+                    portal_path=context.getPortalObject().getPhysicalPath(),\n
+                    mirror=mirror,\n
+                    user_name=context.REQUEST.AUTHENTICATED_USER,\n
+                    simulation_state=context.getProperty(\n
+                          \'simulation_state\', \'no_simulation_state\') )\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_dav_writelocks</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_filepath</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_owner</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>mirror=0</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>1</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>mirror</string>
+                            <string>Products.ERP5Type.Cache</string>
+                            <string>CachingMethod</string>
+                            <string>category_dict</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>category</string>
+                            <string>display_cache</string>
+                            <string>display_funct</string>
+                            <string>display</string>
+                            <string>sort</string>
+                            <string>None</string>
+                            <string>getItemList</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <tuple>
+                <int>0</int>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>AccountingTransactionLine_getNodeItemList</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Persistence</string>
+          <string>PersistentMapping</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_container</string> </key>
+            <value>
+              <dictionary/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_viewSearchDialog/my_node.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_viewSearchDialog/my_node.xml
index 131fef705d..0efe4f402c 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_viewSearchDialog/my_node.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_viewSearchDialog/my_node.xml
@@ -275,7 +275,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python: here.InvoiceTransactionLine_getSourceItemList()</string> </value>
+            <value> <string>here/AccountingTransactionLine_getNodeItemList</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_view/listbox_source.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_view/listbox_source.xml
index f16e7e3397..5a47862c30 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_view/listbox_source.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_view/listbox_source.xml
@@ -281,7 +281,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:cell.getObject().InvoiceTransactionLine_getSourceItemList()</string> </value>
+            <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList()</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewDestinationAsset/listbox_destination.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewDestinationAsset/listbox_destination.xml
index 332c7c7fb5..e9406fe3ea 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewDestinationAsset/listbox_destination.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewDestinationAsset/listbox_destination.xml
@@ -281,7 +281,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:cell.getObject().InvoiceTransactionLine_getDestinationItemList()</string> </value>
+            <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList(mirror=1)</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewDetails/listbox_destination.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewDetails/listbox_destination.xml
index 332c7c7fb5..e9406fe3ea 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewDetails/listbox_destination.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewDetails/listbox_destination.xml
@@ -281,7 +281,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:cell.getObject().InvoiceTransactionLine_getDestinationItemList()</string> </value>
+            <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList(mirror=1)</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewDetails/listbox_source.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewDetails/listbox_source.xml
index f16e7e3397..5a47862c30 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewDetails/listbox_source.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewDetails/listbox_source.xml
@@ -281,7 +281,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:cell.getObject().InvoiceTransactionLine_getSourceItemList()</string> </value>
+            <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList()</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewSourceAsset/listbox_source.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewSourceAsset/listbox_source.xml
index f16e7e3397..5a47862c30 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewSourceAsset/listbox_source.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewSourceAsset/listbox_source.xml
@@ -281,7 +281,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:cell.getObject().InvoiceTransactionLine_getSourceItemList()</string> </value>
+            <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList()</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/BalanceTransaction_view/listbox_source.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/BalanceTransaction_view/listbox_source.xml
index f16e7e3397..5a47862c30 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/BalanceTransaction_view/listbox_source.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/BalanceTransaction_view/listbox_source.xml
@@ -281,7 +281,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:cell.getObject().InvoiceTransactionLine_getSourceItemList()</string> </value>
+            <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList()</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InvoiceTransactionLine_getDestinationItemList.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InvoiceTransactionLine_getDestinationItemList.xml
index 0a4def19cf..7631fb98c5 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InvoiceTransactionLine_getDestinationItemList.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InvoiceTransactionLine_getDestinationItemList.xml
@@ -68,20 +68,10 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>category_dict = {\n
-  \'income\': \'account_type/expense\',\n
-  \'expense\': \'account_type/income\',\n
-  \'payable\': \'account_type/asset/receivable\',\n
-  \'receivable\': \'account_type/liability/payable\',\n
-  \'collected_vat\': \'account_type/asset/receivable/refundable_vat\',\n
-  \'refundable_vat\': \'account_type/liability/payable/collected_vat\',\n
-  \'bank\': \'account_type/asset/cash\',\n
-  \'cash\': \'account_type/asset/cash\',\n
-}\n
-\n
-return context.InvoiceTransactionLine_getSourceItemList(\n
-     category_dict=category_dict,\n
-     caching_method_id=\'InvoiceTransactionLine_getDestinationItemList\' )\n
+            <value> <string>context.log(\'erp5_accounting\',\n
+ \'InvoiceTransactionLine_getDestinationItemList is a deprecated compatibility\'\n
+ \' alias to AccountingTransactionLine_getNodeItemList(mirror=1)\')\n
+return context.AccountingTransactionLine_getNodeItemList(mirror=1)\n
 </string> </value>
         </item>
         <item>
@@ -130,7 +120,6 @@ return context.InvoiceTransactionLine_getSourceItemList(\n
                         <key> <string>co_varnames</string> </key>
                         <value>
                           <tuple>
-                            <string>category_dict</string>
                             <string>_getattr_</string>
                             <string>context</string>
                           </tuple>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InvoiceTransactionLine_getSourceItemList.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InvoiceTransactionLine_getSourceItemList.xml
index 34ce24503b..353eb548d0 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InvoiceTransactionLine_getSourceItemList.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InvoiceTransactionLine_getSourceItemList.xml
@@ -68,57 +68,10 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>from Products.ERP5Type.Cache import CachingMethod\n
-\n
-if category_dict is None:\n
-  # this code is shared by InvoiceTransactionLine_getSourceItemList, \n
-  # which provides it\'s own dict\n
-  category_dict = {\n
-    \'income\': \'account_type/income\',\n
-    \'expense\': \'account_type/expense\',\n
-    \'payable\': \'account_type/liability/payable\',\n
-    \'receivable\': \'account_type/asset/receivable\',\n
-    \'collected_vat\': \'account_type/liability/payable/collected_vat\',\n
-    \'refundable_vat\': \'account_type/asset/receivable/refundable_vat\',\n
-    \'bank\': \'account_type/asset/cash\',\n
-  }\n
-category = category_dict.get(context.getId(), \'account_type\')\n
-\n
-\n
-display_cache = {}\n
-display_funct = context.Account_getFormattedTitle\n
-\n
-def display(x):\n
-  if x not in display_cache:\n
-    display_cache[x] = display_funct(x)\n
-  return display_cache[x]\n
-\n
-def sort(x,y):\n
-  return cmp(display(x), display(y))\n
-\n
-def getItemList(category=None, portal_path=None, user_name=None, simulation_state=None):\n
-  """Returns a list of Account path items. """\n
-  cat = context.portal_categories.resolveCategory(category)\n
-  filter_dict = {}\n
-\n
-  # we don\'t filter in existing transactions or report / search dialogs\n
-  if simulation_state not in (\'delivered\', \'cancelled\', \'no_simulation_state\') :\n
-    filter_dict[\'validation_state\'] = (\'draft\', \'validated\')\n
-  \n
-  item_list = cat.getCategoryMemberItemList(portal_type=\'Account\', base=0,\n
-                      display_method=display, sort_method=sort, filter=filter_dict)\n
-  return item_list\n
-\n
-# wrap the previous method in a cache\n
-getItemList = CachingMethod(getItemList, id=caching_method_id)\n
-\n
-# the cache vary with the simulation state of the current transaction,\n
-# to display all accounts when the transaction is already delivered.\n
-return getItemList( category=category,\n
-                    portal_path=context.getPortalObject().getPhysicalPath(), \n
-                    user_name=context.REQUEST.AUTHENTICATED_USER,\n
-                    simulation_state=context.getProperty(\n
-                          \'simulation_state\', \'no_simulation_state\') )\n
+            <value> <string>context.log(\'erp5_accounting\',\n
+ \'InvoiceTransactionLine_getSourceItemList is a deprecated compatibility\'\n
+ \' alias to AccountingTransactionLine_getNodeItemList()\')\n
+return context.AccountingTransactionLine_getNodeItemList()\n
 </string> </value>
         </item>
         <item>
@@ -169,17 +122,8 @@ return getItemList( category=category,\n
                           <tuple>
                             <string>category_dict</string>
                             <string>caching_method_id</string>
-                            <string>Products.ERP5Type.Cache</string>
-                            <string>CachingMethod</string>
-                            <string>None</string>
                             <string>_getattr_</string>
                             <string>context</string>
-                            <string>category</string>
-                            <string>display_cache</string>
-                            <string>display_funct</string>
-                            <string>display</string>
-                            <string>sort</string>
-                            <string>getItemList</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PaymentTransaction_view/listbox_source.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PaymentTransaction_view/listbox_source.xml
index f16e7e3397..5a47862c30 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PaymentTransaction_view/listbox_source.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PaymentTransaction_view/listbox_source.xml
@@ -281,7 +281,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:cell.getObject().InvoiceTransactionLine_getSourceItemList()</string> </value>
+            <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList()</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PaymentTransaction_viewDetails/listbox_destination.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PaymentTransaction_viewDetails/listbox_destination.xml
index 332c7c7fb5..e9406fe3ea 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PaymentTransaction_viewDetails/listbox_destination.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PaymentTransaction_viewDetails/listbox_destination.xml
@@ -281,7 +281,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:cell.getObject().InvoiceTransactionLine_getDestinationItemList()</string> </value>
+            <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList(mirror=1)</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PaymentTransaction_viewDetails/listbox_source.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PaymentTransaction_viewDetails/listbox_source.xml
index f16e7e3397..5a47862c30 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PaymentTransaction_viewDetails/listbox_source.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PaymentTransaction_viewDetails/listbox_source.xml
@@ -281,7 +281,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:cell.getObject().InvoiceTransactionLine_getSourceItemList()</string> </value>
+            <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList()</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PurchaseInvoiceTransaction_init.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PurchaseInvoiceTransaction_init.xml
index 789da7fa17..95f49e54c3 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PurchaseInvoiceTransaction_init.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PurchaseInvoiceTransaction_init.xml
@@ -82,11 +82,11 @@ transaction.edit (\n
     resource = preference_tool.getPreferredAccountingTransactionCurrency())\n
 \n
 transaction.newContent(portal_type=\'Purchase Invoice Transaction Line\',\n
-                       id=\'income\', )\n
+                       id=\'expense\', )\n
 transaction.newContent(portal_type=\'Purchase Invoice Transaction Line\',\n
-                       id=\'receivable\', )\n
+                       id=\'payable\', )\n
 transaction.newContent(portal_type=\'Purchase Invoice Transaction Line\',\n
-                       id=\'collected_vat\', )\n
+                       id=\'refundable_vat\', )\n
 </string> </value>
         </item>
         <item>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PurchaseInvoiceTransaction_viewAccounting/listbox_destination.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PurchaseInvoiceTransaction_viewAccounting/listbox_destination.xml
index 332c7c7fb5..ddba0b2717 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PurchaseInvoiceTransaction_viewAccounting/listbox_destination.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PurchaseInvoiceTransaction_viewAccounting/listbox_destination.xml
@@ -281,7 +281,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:cell.getObject().InvoiceTransactionLine_getDestinationItemList()</string> </value>
+            <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList()</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PurchaseInvoiceTransaction_viewDetails/listbox_destination.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PurchaseInvoiceTransaction_viewDetails/listbox_destination.xml
index 332c7c7fb5..ddba0b2717 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PurchaseInvoiceTransaction_viewDetails/listbox_destination.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PurchaseInvoiceTransaction_viewDetails/listbox_destination.xml
@@ -281,7 +281,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:cell.getObject().InvoiceTransactionLine_getDestinationItemList()</string> </value>
+            <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList()</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PurchaseInvoiceTransaction_viewDetails/listbox_source.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PurchaseInvoiceTransaction_viewDetails/listbox_source.xml
index f16e7e3397..6b21eed468 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PurchaseInvoiceTransaction_viewDetails/listbox_source.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/PurchaseInvoiceTransaction_viewDetails/listbox_source.xml
@@ -281,7 +281,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:cell.getObject().InvoiceTransactionLine_getSourceItemList()</string> </value>
+            <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList(mirror=1)</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/SaleInvoiceTransaction_viewAccounting/listbox_destination.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/SaleInvoiceTransaction_viewAccounting/listbox_destination.xml
index 332c7c7fb5..e9406fe3ea 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/SaleInvoiceTransaction_viewAccounting/listbox_destination.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/SaleInvoiceTransaction_viewAccounting/listbox_destination.xml
@@ -281,7 +281,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:cell.getObject().InvoiceTransactionLine_getDestinationItemList()</string> </value>
+            <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList(mirror=1)</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/SaleInvoiceTransaction_viewAccounting/listbox_source.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/SaleInvoiceTransaction_viewAccounting/listbox_source.xml
index f16e7e3397..5a47862c30 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/SaleInvoiceTransaction_viewAccounting/listbox_source.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/SaleInvoiceTransaction_viewAccounting/listbox_source.xml
@@ -281,7 +281,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:cell.getObject().InvoiceTransactionLine_getSourceItemList()</string> </value>
+            <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList()</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/SaleInvoiceTransaction_viewDetails/listbox_destination.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/SaleInvoiceTransaction_viewDetails/listbox_destination.xml
index 332c7c7fb5..e9406fe3ea 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/SaleInvoiceTransaction_viewDetails/listbox_destination.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/SaleInvoiceTransaction_viewDetails/listbox_destination.xml
@@ -281,7 +281,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:cell.getObject().InvoiceTransactionLine_getDestinationItemList()</string> </value>
+            <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList(mirror=1)</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/SaleInvoiceTransaction_viewDetails/listbox_source.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/SaleInvoiceTransaction_viewDetails/listbox_source.xml
index f16e7e3397..5a47862c30 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/SaleInvoiceTransaction_viewDetails/listbox_source.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/SaleInvoiceTransaction_viewDetails/listbox_source.xml
@@ -281,7 +281,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:cell.getObject().InvoiceTransactionLine_getSourceItemList()</string> </value>
+            <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList()</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_accounting/bt/change_log b/bt5/erp5_accounting/bt/change_log
index 477ee294dc..c76984f146 100644
--- a/bt5/erp5_accounting/bt/change_log
+++ b/bt5/erp5_accounting/bt/change_log
@@ -1,3 +1,6 @@
+2006-08-11 jerome
+* remove InvoiceTransactionLine_getDestinationItemList and InvoiceTransactionLine_getSourceItemList in favor of AccountingTransactionLine_getNodeItemList, which fixes source/destination inversion on lines ids for Purchase Invoice Transactions.
+
 2006-07-03 Kevin
 * Move Base_importGapFile script from gap_importer business template.
 
-- 
2.30.9