From 2aecdf928049445d8c4d180fc5e7dad9bd221d98 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Thu, 1 Mar 2007 15:20:02 +0000
Subject: [PATCH] If we have a transfer using an external payment, display the
 title of the external payment, not the title of the third party.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13154 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 ...rorExternalPaymentOrMirrorSectionTitle.xml | 186 ++++++++++++++++++
 .../listbox.xml                               |   2 +-
 bt5/erp5_accounting_l10n_fr_m9/bt/revision    |   2 +-
 3 files changed, 188 insertions(+), 2 deletions(-)
 create mode 100644 bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/PaymentTransaction_getMirrorExternalPaymentOrMirrorSectionTitle.xml

diff --git a/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/PaymentTransaction_getMirrorExternalPaymentOrMirrorSectionTitle.xml b/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/PaymentTransaction_getMirrorExternalPaymentOrMirrorSectionTitle.xml
new file mode 100644
index 0000000000..760d3e89c5
--- /dev/null
+++ b/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/PaymentTransaction_getMirrorExternalPaymentOrMirrorSectionTitle.xml
@@ -0,0 +1,186 @@
+<?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>"""Returns the mirror payment title if it\'s an External Payment,\n
+otherwise return the mirror section title.\n
+"""\n
+if selection is None:\n
+  # TODO: this should definitivly be REQUEST chached\n
+  selection = context.portal_selections.getSelectionFor(\'accounting_selection\')\n
+\n
+section_category=selection.getParams().get(\'section_category\')\n
+if not section_category:\n
+  return\n
+\n
+if brain is not None:\n
+  transaction = brain.getObject()\n
+else:\n
+  transaction = context\n
+\n
+source_section = transaction.getSourceSectionValue()\n
+if source_section is not None and source_section.isMemberOf(section_category):\n
+  external_payment = transaction.getDestinationPaymentValue(portal_type=\'External Payment\')\n
+  if external_payment is not None:\n
+    return external_payment.getShortTitle() or external_payment.getTitle()\n
+  return transaction.getDestinationSectionTitle()\n
+\n
+external_payment = transaction.getSourcePaymentValue(portal_type=\'External Payment\')\n
+if external_payment is not None:\n
+  return external_payment.getShortTitle() or external_payment.getTitle()\n
+return transaction.getSourceSectionTitle()\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </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>brain=None, selection=None, **kw</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>2</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>brain</string>
+                            <string>selection</string>
+                            <string>kw</string>
+                            <string>None</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>section_category</string>
+                            <string>transaction</string>
+                            <string>source_section</string>
+                            <string>external_payment</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <tuple>
+                <none/>
+                <none/>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>PaymentTransaction_getMirrorExternalPaymentOrMirrorSectionTitle</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/Transfer_viewTransferReportSection/listbox.xml b/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/Transfer_viewTransferReportSection/listbox.xml
index 751f18e459..06c7daa06f 100644
--- a/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/Transfer_viewTransferReportSection/listbox.xml
+++ b/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/Transfer_viewTransferReportSection/listbox.xml
@@ -338,7 +338,7 @@
                           <string>Mandat</string>
                         </tuple>
                         <tuple>
-                          <string>AccountingTransaction_getThirdPartyTitle</string>
+                          <string>PaymentTransaction_getMirrorExternalPaymentOrMirrorSectionTitle</string>
                           <string>Third Party</string>
                         </tuple>
                         <tuple>
diff --git a/bt5/erp5_accounting_l10n_fr_m9/bt/revision b/bt5/erp5_accounting_l10n_fr_m9/bt/revision
index efee1f88bb..eb13855b7d 100644
--- a/bt5/erp5_accounting_l10n_fr_m9/bt/revision
+++ b/bt5/erp5_accounting_l10n_fr_m9/bt/revision
@@ -1 +1 @@
-78
\ No newline at end of file
+79
\ No newline at end of file
-- 
2.30.9