From be50fa7dd9c4ad28fb5f9ef4e798bf7189941d59 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Wed, 4 Oct 2017 09:02:56 +0000
Subject: [PATCH] accounting: allow choose bank account directly on internal
 invoice transaction

Internal Invoice Transactions are used for any kind of internal
transaction (invoice, payment etc). To make it easier to input
payment, we allow selecting the bank account directly from the view of
the transaction, this way users do not have to enter the line and set on
each line.
---
 ...rnalInvoiceTransaction_viewDestination.xml |   1 +
 .../my_destination_payment.xml                | 116 ++++++++++++++++++
 .../InternalInvoiceTransaction_viewSource.xml |   1 +
 .../my_source_payment.xml                     |  90 ++++++++++++++
 4 files changed, 208 insertions(+)
 create mode 100644 bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InternalInvoiceTransaction_viewDestination/my_destination_payment.xml
 create mode 100644 bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InternalInvoiceTransaction_viewSource/my_source_payment.xml

diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InternalInvoiceTransaction_viewDestination.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InternalInvoiceTransaction_viewDestination.xml
index 0dd84fc565..5f34a1d8a1 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InternalInvoiceTransaction_viewDestination.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InternalInvoiceTransaction_viewDestination.xml
@@ -102,6 +102,7 @@
                     <value>
                       <list>
                         <string>my_destination_section</string>
+                        <string>my_destination_payment</string>
                         <string>my_destination_reference</string>
                         <string>my_title</string>
                         <string>my_source_section</string>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InternalInvoiceTransaction_viewDestination/my_destination_payment.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InternalInvoiceTransaction_viewDestination/my_destination_payment.xml
new file mode 100644
index 0000000000..03afaf3962
--- /dev/null
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InternalInvoiceTransaction_viewDestination/my_destination_payment.xml
@@ -0,0 +1,116 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>delegated_list</string> </key>
+            <value>
+              <list>
+                <string>title</string>
+                <string>items</string>
+              </list>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>my_destination_payment</string> </value>
+        </item>
+        <item>
+            <key> <string>message_values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>external_validator_failed</string> </key>
+                    <value> <string>The input failed the external validator.</string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>overrides</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>tales</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>items</string> </key>
+                    <value>
+                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+                    </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string>my_destination_payment</string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string>AccountingTransaction_viewFieldLibrary</string> </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string>Click to edit the target</string> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string>Section Bank Account</string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <global name="TALESMethod" module="Products.Formulator.TALESField"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string>python:here.AccountingTransaction_getDestinationPaymentItemList()</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InternalInvoiceTransaction_viewSource.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InternalInvoiceTransaction_viewSource.xml
index 0736e1d541..20644cd8ce 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InternalInvoiceTransaction_viewSource.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InternalInvoiceTransaction_viewSource.xml
@@ -102,6 +102,7 @@
                     <value>
                       <list>
                         <string>my_source_section</string>
+                        <string>my_source_payment</string>
                         <string>my_source_reference</string>
                         <string>my_title</string>
                         <string>my_destination_section_title</string>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InternalInvoiceTransaction_viewSource/my_source_payment.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InternalInvoiceTransaction_viewSource/my_source_payment.xml
new file mode 100644
index 0000000000..ea96fd8753
--- /dev/null
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InternalInvoiceTransaction_viewSource/my_source_payment.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>delegated_list</string> </key>
+            <value>
+              <list/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>my_source_payment</string> </value>
+        </item>
+        <item>
+            <key> <string>message_values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>external_validator_failed</string> </key>
+                    <value> <string>The input failed the external validator.</string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>overrides</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>tales</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string>my_source_payment</string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string>AccountingTransaction_viewFieldLibrary</string> </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string>Click to edit the target</string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
-- 
2.30.9