From b8e256a1ca4e416043aba73c3841aa3c7542add4 Mon Sep 17 00:00:00 2001
From: Kevin Deldycke <kevin@nexedi.com>
Date: Thu, 1 Jun 2006 16:49:35 +0000
Subject: [PATCH] Factorize Debtor / Creditor code.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7578 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../FiscalReportCell_creditorAccountsSum.xml  |  60 +----
 ...ReportCell_creditorBankAccountsBalance.xml |  61 +----
 .../FiscalReportCell_debtorAccountsSum.xml    |  60 +----
 ...alReportCell_debtorBankAccountsBalance.xml |  59 +----
 .../FiscalReportCell_getBalance.xml           | 235 ++++++++++++++++++
 ...FiscalReportCell_getBankAccountBalance.xml | 209 ++++++++++++++++
 6 files changed, 468 insertions(+), 216 deletions(-)
 create mode 100644 bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_getBalance.xml
 create mode 100644 bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_getBankAccountBalance.xml

diff --git a/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_creditorAccountsSum.xml b/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_creditorAccountsSum.xml
index 9763a3f96a..f381561a25 100644
--- a/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_creditorAccountsSum.xml
+++ b/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_creditorAccountsSum.xml
@@ -68,46 +68,9 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string encoding="cdata"><![CDATA[
-
-"""\n
-  This script adds accounts value, only if they are creditors.\n
-"""\n
-\n
-def shortAccountNumberToFullGapCategory(accountNumber) :\n
-  """\n
-    Translates a short account number (eg 280) to a full gap category url (eg gap/2/28/280).\n
-  """\n
-  accountNumber = accountNumber.strip()\n
-  gap = request.get("gap_base", kwd.get("gap_base", "gap/fr/pcg/"))\n
-  for i in range(len(accountNumber)):\n
-    gap += accountNumber[:i+1]+"/"\n
-  return gap[:-1]\n
-\n
-request=context.REQUEST\n
-kw = dict(kwd)\n
-kw[\'simulation_state\'] = kwd.get(\'simulation_state\', request.get(\'simulation_state\', [\'stopped\', \'delivered\']))\n
-\n
-if kw.get("resource") :\n
-  kw["resource"]        = kwd[\'resource\']\n
-kw["section_category"]  = kwd.get("section_category",\n
-                            "group/%s"%context.restrictedTraverse(request.get("organisation")).getGroup())\n
-kw[\'to_date\'] = kwd.get(\'at_date\', request[\'at_date\']) +1\n
-kw[\'where_expression\'] = " section.portal_type = \'Organisation\' "\n
-\n
-sum = 0.0\n
-for accountNumber in accounts :\n
-  # we get all acounts strict member of this GAP category\n
-  gap = context.restrictedTraverse("portal_categories/"+shortAccountNumberToFullGapCategory(accountNumber))\n
-  for account in gap.getGapRelatedValueList(portal_type=\'Account\') :\n
-    result = context.getPortalObject().portal_simulation.getInventoryAssetPrice( node_uid = account.getUid(), **kw )\n
-    if result < 0 :\n
-      sum += result\n
-return sum\n
-# vim: syntax=python\n
-
-
-]]></string> </value>
+            <value> <string>context.log("Naming Convention Violation", "FiscalReportCell_creditorAccountsSum should be renamed FiscalReportCell_getCreditorBalance")\n
+return context.FiscalReportCell_getBalance(accounts, creditor_only=True, **kw)\n
+</string> </value>
         </item>
         <item>
             <key> <string>_code</string> </key>
@@ -133,7 +96,7 @@ return sum\n
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>accounts, **kwd</string> </value>
+            <value> <string>accounts, **kw</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -160,22 +123,11 @@ return sum\n
                         <value>
                           <tuple>
                             <string>accounts</string>
-                            <string>kwd</string>
-                            <string>request</string>
-                            <string>shortAccountNumberToFullGapCategory</string>
+                            <string>kw</string>
                             <string>_getattr_</string>
                             <string>context</string>
-                            <string>dict</string>
-                            <string>kw</string>
-                            <string>_write_</string>
-                            <string>_getitem_</string>
-                            <string>sum</string>
-                            <string>_getiter_</string>
-                            <string>accountNumber</string>
-                            <string>gap</string>
-                            <string>account</string>
                             <string>_apply_</string>
-                            <string>result</string>
+                            <string>True</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_creditorBankAccountsBalance.xml b/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_creditorBankAccountsBalance.xml
index 825d8a6b6d..fc31f2a8e8 100644
--- a/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_creditorBankAccountsBalance.xml
+++ b/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_creditorBankAccountsBalance.xml
@@ -68,48 +68,9 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string encoding="cdata"><![CDATA[
-
-"""\n
-  This script adds bank accounts balances, only if they are creditors\n
-"""\n
-\n
-request=context.REQUEST\n
-kw = dict(kwd)\n
-kw[\'simulation_state\'] = kwd.get(\'simulation_state\', request.get(\'simulation_state\', [\'stopped\', \'delivered\']))\n
-if kw.get("resource") :\n
-  kw["resource"]        = kwd[\'resource\']\n
-kw["section_category"]  = kwd.get("section_category", \n
-                            "group/%s"%context.restrictedTraverse(request.get("organisation")).getGroup())\n
-kw[\'at_date\'] = kwd.get(\'at_date\', request[\'at_date\'])\n
-kw[\'where_expression\'] = " section.portal_type = \'Organisation\' "\n
-\n
-\n
-def shortAccountNumberToFullGapCategory(accountNumber) :\n
-  """ translates a short account number (eg 280) to a full gap category url \n
-    (eg gap/fr/gap/2/28/280) """\n
-  accountNumber = accountNumber.strip()\n
-  gap = request.get("gap_base", "gap/fr/pcg/")\n
-  for i in range(len(accountNumber)) :\n
-    gap += accountNumber[:i+1]+"/"\n
-  return gap[:-1]\n
-\n
-sum = 0.0\n
-for account in accounts :\n
-  for bank in context.restrictedTraverse(request.get("organisation")).searchFolder(\n
-                                                                    portal_type=context.getPortalPaymentNodeTypeList()) : \n
-    bank = bank.getObject()\n
-    result = context.getPortalObject().portal_simulation.getInventoryAssetPrice( \n
-                                       payment_uid = bank.getUid(),\n
-                                       node_category = shortAccountNumberToFullGapCategory(account), \n
-                                       **kw )\n
-    if result < 0 : \n
-      sum += result\n
-\n
-return sum\n
-
-
-]]></string> </value>
+            <value> <string>context.log("Naming Convention Violation", "FiscalReportCell_creditorBankAccountsBalance should be renamed FiscalReportCell_getCreditorBankAccountBalance")\n
+return context.FiscalReportCell_getBankAccountBalance(accounts, creditor_only=True, **kw)\n
+</string> </value>
         </item>
         <item>
             <key> <string>_code</string> </key>
@@ -129,7 +90,7 @@ return sum\n
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>accounts, **kwd</string> </value>
+            <value> <string>accounts, **kw</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -156,21 +117,11 @@ return sum\n
                         <value>
                           <tuple>
                             <string>accounts</string>
-                            <string>kwd</string>
+                            <string>kw</string>
                             <string>_getattr_</string>
                             <string>context</string>
-                            <string>request</string>
-                            <string>dict</string>
-                            <string>kw</string>
-                            <string>_write_</string>
-                            <string>_getitem_</string>
-                            <string>shortAccountNumberToFullGapCategory</string>
-                            <string>sum</string>
-                            <string>_getiter_</string>
-                            <string>account</string>
-                            <string>bank</string>
                             <string>_apply_</string>
-                            <string>result</string>
+                            <string>True</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_debtorAccountsSum.xml b/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_debtorAccountsSum.xml
index 5c756df948..c93f0befdc 100644
--- a/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_debtorAccountsSum.xml
+++ b/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_debtorAccountsSum.xml
@@ -68,46 +68,9 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string encoding="cdata"><![CDATA[
-
-"""\n
-  This script adds accounts value, only if they are debtors.\n
-"""\n
-\n
-def shortAccountNumberToFullGapCategory(accountNumber) :\n
-  """\n
-    Translates a short account number (eg 280) to a full gap category url (eg gap/2/28/280).\n
-  """\n
-  accountNumber = accountNumber.strip()\n
-  gap = request.get("gap_base", kwd.get(\'gap_base\', \'gap/fr/pcg/\'))\n
-  for i in range(len(accountNumber)):\n
-    gap += accountNumber[:i+1] + \'/\'\n
-  return gap[:-1]\n
-\n
-request=context.REQUEST\n
-kw = dict(kwd)\n
-kw[\'simulation_state\'] = kwd.get(\'simulation_state\', request.get(\'simulation_state\', [\'stopped\', \'delivered\']))\n
-kw["section_category"]  = kwd.get("section_category",\n
-                            "group/%s"%context.restrictedTraverse(request.get("organisation")).getGroup())\n
-kw[\'at_date\'] = kwd.get(\'at_date\', request[\'at_date\'])\n
-kw[\'where_expression\'] = " section.portal_type = \'Organisation\' "\n
-\n
-if kw.get("resource"):\n
-  kw["resource"]        = kwd[\'resource\']\n
-\n
-\n
-sum = 0.0\n
-for accountNumber in accounts:\n
-  # we get all acounts strict member of this GAP category\n
-  gap = context.restrictedTraverse(\'portal_categories/\' + shortAccountNumberToFullGapCategory(accountNumber))\n
-  for account in gap.getGapRelatedValueList(portal_type=\'Account\'):\n
-    result = context.getPortalObject().portal_simulation.getInventoryAssetPrice(node_uid = account.getUid(), **kw)\n
-    if result > 0:\n
-      sum += result\n
-return sum\n
-
-
-]]></string> </value>
+            <value> <string>context.log("Naming Convention Violation", "FiscalReportCell_debtorAccountsSum should be renamed FiscalReportCell_getDebtorBalance")\n
+return context.FiscalReportCell_getBalance(accounts, debtor_only=True, **kw)\n
+</string> </value>
         </item>
         <item>
             <key> <string>_code</string> </key>
@@ -133,7 +96,7 @@ return sum\n
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>accounts, **kwd</string> </value>
+            <value> <string>accounts, **kw</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -160,22 +123,11 @@ return sum\n
                         <value>
                           <tuple>
                             <string>accounts</string>
-                            <string>kwd</string>
-                            <string>request</string>
-                            <string>shortAccountNumberToFullGapCategory</string>
+                            <string>kw</string>
                             <string>_getattr_</string>
                             <string>context</string>
-                            <string>dict</string>
-                            <string>kw</string>
-                            <string>_write_</string>
-                            <string>_getitem_</string>
-                            <string>sum</string>
-                            <string>_getiter_</string>
-                            <string>accountNumber</string>
-                            <string>gap</string>
-                            <string>account</string>
                             <string>_apply_</string>
-                            <string>result</string>
+                            <string>True</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_debtorBankAccountsBalance.xml b/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_debtorBankAccountsBalance.xml
index 3bb45402a6..5bf5dd95db 100644
--- a/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_debtorBankAccountsBalance.xml
+++ b/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_debtorBankAccountsBalance.xml
@@ -68,46 +68,9 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string encoding="cdata"><![CDATA[
-
-"""\n
-  This script adds bank accounts balances, only if they are debtors\n
-"""\n
-\n
-request=context.REQUEST\n
-kw = dict(kwd)\n
-kw[\'simulation_state\'] = kwd.get(\'simulation_state\', request.get(\'simulation_state\', [\'stopped\', \'delivered\']))\n
-kw["section_category"]  = kwd.get("section_category", \n
-                            "group/%s"%context.restrictedTraverse(request.get("organisation")).getGroup())\n
-kw[\'at_date\'] = kwd.get(\'at_date\', request[\'at_date\'])\n
-kw[\'where_expression\'] = " section.portal_type = \'Organisation\' "\n
-\n
-\n
-def shortAccountNumberToFullGapCategory(accountNumber) :\n
-  """ translates a short account number (eg 280) to a full gap category url \n
-    (eg gap/fr/gap/2/28/280) """\n
-  accountNumber = accountNumber.strip()\n
-  gap = request.get("gap_base", "gap/fr/pcg/")\n
-  for i in range(len(accountNumber)) :\n
-    gap += accountNumber[:i+1]+"/"\n
-  return gap[:-1]\n
-\n
-\n
-sum = 0.0\n
-for account in accounts :\n
-  for bank in context.restrictedTraverse(request.get("organisation"))\\\n
-                       .searchFolder(portal_type=context.getPortalPaymentNodeTypeList()) : \n
-    bank = bank.getObject()\n
-    result = context.getPortalObject().portal_simulation.getInventoryAssetPrice( \n
-                                       payment_uid = bank.getUid(),\n
-                                       node_category = shortAccountNumberToFullGapCategory(account), \n
-                                       **kw )\n
-    if result > 0 : \n
-      sum += result\n
-return sum\n
-
-
-]]></string> </value>
+            <value> <string>context.log("Naming Convention Violation", "FiscalReportCell_debtorBankAccountsBalance should be renamed FiscalReportCell_getDebtorBankAccountBalance")\n
+return context.FiscalReportCell_getBankAccountBalance(accounts, debtor_only=True, **kw)\n
+</string> </value>
         </item>
         <item>
             <key> <string>_code</string> </key>
@@ -127,7 +90,7 @@ return sum\n
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>accounts, **kwd</string> </value>
+            <value> <string>accounts, **kw</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -154,21 +117,11 @@ return sum\n
                         <value>
                           <tuple>
                             <string>accounts</string>
-                            <string>kwd</string>
+                            <string>kw</string>
                             <string>_getattr_</string>
                             <string>context</string>
-                            <string>request</string>
-                            <string>dict</string>
-                            <string>kw</string>
-                            <string>_write_</string>
-                            <string>_getitem_</string>
-                            <string>shortAccountNumberToFullGapCategory</string>
-                            <string>sum</string>
-                            <string>_getiter_</string>
-                            <string>account</string>
-                            <string>bank</string>
                             <string>_apply_</string>
-                            <string>result</string>
+                            <string>True</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_getBalance.xml b/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_getBalance.xml
new file mode 100644
index 0000000000..265d595c65
--- /dev/null
+++ b/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_getBalance.xml
@@ -0,0 +1,235 @@
+<?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 encoding="cdata"><![CDATA[
+
+"""\n
+  This script adds accounts value.\n
+"""\n
+\n
+request = context.REQUEST\n
+\n
+include_debtor   = True\n
+include_creditor = True\n
+if debtor_only  : include_creditor = False\n
+if creditor_only: include_debtor   = False\n
+\n
+gap_base = request.get(\'gap_base\', kwd.get(\'gap_base\', \'gap/fr/pcg/\'))\n
+getURL   = lambda gap_id: context.GAPCategory_getURLFromId(gap_id, gap_base)\n
+\n
+\n
+kw = dict(kwd)\n
+kw[\'simulation_state\'] = kwd.get(\'simulation_state\', request.get(\'simulation_state\', [\'stopped\', \'delivered\']))\n
+kw["section_category"]  = kwd.get("section_category",\n
+                            "group/%s"%context.restrictedTraverse(request.get("organisation")).getGroup())\n
+kw[\'to_date\'] = kwd.get(\'at_date\', request[\'at_date\']) +1\n
+kw[\'where_expression\'] = " section.portal_type = \'Organisation\' "\n
+\n
+sum = 0.0\n
+for accountNumber in accounts:\n
+  # we get all acounts strict member of this GAP category\n
+  gap = context.restrictedTraverse("portal_categories/" + getURL(accountNumber))\n
+  for account in gap.getGapRelatedValueList(portal_type=\'Account\') :\n
+    result = context.getPortalObject().portal_simulation.getInventoryAssetPrice(node_uid = account.getUid(), **kw)\n
+    if (result < 0 and include_creditor) or \\\n
+       (result > 0 and include_debtor):\n
+      sum += result\n
+\n
+return sum\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> <string>Script (Python):/nexedi/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_getBalance</string> </value>
+        </item>
+        <item>
+            <key> <string>_owner</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>accounts, debtor_only=False, creditor_only=False, **kwd</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>3</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>accounts</string>
+                            <string>debtor_only</string>
+                            <string>creditor_only</string>
+                            <string>kwd</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>request</string>
+                            <string>True</string>
+                            <string>include_debtor</string>
+                            <string>include_creditor</string>
+                            <string>False</string>
+                            <string>gap_base</string>
+                            <string>getURL</string>
+                            <string>dict</string>
+                            <string>kw</string>
+                            <string>_write_</string>
+                            <string>_getitem_</string>
+                            <string>sum</string>
+                            <string>_getiter_</string>
+                            <string>accountNumber</string>
+                            <string>gap</string>
+                            <string>account</string>
+                            <string>_apply_</string>
+                            <string>result</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <tuple>
+                <int>0</int>
+                <int>0</int>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>FiscalReportCell_getBalance</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_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_getBankAccountBalance.xml b/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_getBankAccountBalance.xml
new file mode 100644
index 0000000000..99738768ec
--- /dev/null
+++ b/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_getBankAccountBalance.xml
@@ -0,0 +1,209 @@
+<?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 encoding="cdata"><![CDATA[
+
+"""\n
+  This script adds bank accounts balances\n
+"""\n
+\n
+request = context.REQUEST\n
+\n
+include_debtor   = True\n
+include_creditor = True\n
+if debtor_only  : include_creditor = False\n
+if creditor_only: include_debtor   = False\n
+\n
+gap_base = request.get(\'gap_base\', kwd.get(\'gap_base\', \'gap/fr/pcg/\'))\n
+getURL   = lambda gap_id: context.GAPCategory_getURLFromId(gap_id, gap_base)\n
+\n
+kw = dict(kwd)\n
+kw[\'simulation_state\'] = kwd.get(\'simulation_state\', request.get(\'simulation_state\', [\'stopped\', \'delivered\']))\n
+kw["section_category"]  = kwd.get("section_category",\n
+                            "group/%s"%context.restrictedTraverse(request.get("organisation")).getGroup())\n
+kw[\'at_date\'] = kwd.get(\'at_date\', request[\'at_date\'])\n
+kw[\'where_expression\'] = " section.portal_type = \'Organisation\' "\n
+\n
+\n
+sum = 0.0\n
+for account in accounts:\n
+  for bank in context.restrictedTraverse(request.get("organisation"))\\\n
+                       .searchFolder(portal_type=context.getPortalPaymentNodeTypeList()) :\n
+    bank = bank.getObject()\n
+    result = context.getPortalObject().portal_simulation.getInventoryAssetPrice(\n
+                                       payment_uid = bank.getUid(),\n
+                                       node_category = getURL(account),\n
+                                       **kw )\n
+    if (result < 0 and include_creditor) or \\\n
+       (result > 0 and include_debtor):\n
+      sum += result\n
+return sum\n
+
+
+]]></string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_filepath</string> </key>
+            <value> <string>Script (Python):/nexedi/portal_skins/erp5_accounting_l10n_fr/FiscalReportCell_getBankAccountBalance</string> </value>
+        </item>
+        <item>
+            <key> <string>_owner</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>accounts, debtor_only=False, creditor_only=False, **kwd</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>3</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>accounts</string>
+                            <string>debtor_only</string>
+                            <string>creditor_only</string>
+                            <string>kwd</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>request</string>
+                            <string>True</string>
+                            <string>include_debtor</string>
+                            <string>include_creditor</string>
+                            <string>False</string>
+                            <string>gap_base</string>
+                            <string>getURL</string>
+                            <string>dict</string>
+                            <string>kw</string>
+                            <string>_write_</string>
+                            <string>_getitem_</string>
+                            <string>sum</string>
+                            <string>_getiter_</string>
+                            <string>account</string>
+                            <string>bank</string>
+                            <string>_apply_</string>
+                            <string>result</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <tuple>
+                <int>0</int>
+                <int>0</int>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>FiscalReportCell_getBankAccountBalance</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
-- 
2.30.9