From 83fc8d8ac6a5389dd2472fb7159b421c4f093b9d Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Fri, 15 Dec 2006 13:38:53 +0000
Subject: [PATCH] fixed a few fields call constraint checkers inside several
 workflows

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11733 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../portal_types/Account%20Incident.xml       |   2 +-
 .../AccountIncident_getBaobabSource.xml       | 211 ++++++++++++++++
 ...AccountIncident_getBaobabSourcePayment.xml | 177 ++++++++++++++
 .../AccountIncident_statSourceCredit.xml      | 156 ++++++++++++
 .../AccountIncident_statSourceDebit.xml       | 156 ++++++++++++
 .../AccountTransfer_duplicate.xml             | 230 ++++++++++++++++++
 .../CurrencyPurchase_view/my_source.xml       |   2 +-
 .../CurrencySale_view/my_source.xml           |   2 +-
 .../ForeignCashReception_view/my_resource.xml |   2 +-
 .../my_source_section.xml                     |   2 +-
 .../MonetaryIssue_fastInputForm/listbox.xml   |   4 +
 ...taryIssue_viewCashContainerInputDialog.xml |  16 +-
 .../MonetaryReception_view/listbox.xml        |   6 +-
 .../MoneyDeposit_getBaobabDestination.xml     |  10 +-
 .../MoneyDeposit_view/my_destination.xml      |   2 +-
 .../my_source_transport.xml                   |   2 +-
 .../scripts/checkConsistency.xml              |   4 +-
 .../scripts/validateBalance.xml               |  10 +
 .../scripts/validatePositionAccounting.xml    |   2 +-
 .../transitions/plan.xml                      |   2 +-
 .../transitions/plan_action.xml               |   4 +-
 .../scripts/validateVaultBalance.xml          |   9 +
 .../scripts/checkDestination.xml              |  23 +-
 .../scripts/validateVaultBalance.xml          |   5 -
 .../scripts/validateVaultBalance.xml          |   9 +
 bt5/erp5_banking_cash/bt/revision             |   2 +-
 26 files changed, 1021 insertions(+), 29 deletions(-)
 create mode 100644 bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/AccountIncident_getBaobabSource.xml
 create mode 100644 bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/AccountIncident_getBaobabSourcePayment.xml
 create mode 100644 bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/AccountIncident_statSourceCredit.xml
 create mode 100644 bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/AccountIncident_statSourceDebit.xml
 create mode 100644 bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/AccountTransfer_duplicate.xml

diff --git a/bt5/erp5_banking_cash/PortalTypeTemplateItem/portal_types/Account%20Incident.xml b/bt5/erp5_banking_cash/PortalTypeTemplateItem/portal_types/Account%20Incident.xml
index 1dfa68b531..92b10b46af 100644
--- a/bt5/erp5_banking_cash/PortalTypeTemplateItem/portal_types/Account%20Incident.xml
+++ b/bt5/erp5_banking_cash/PortalTypeTemplateItem/portal_types/Account%20Incident.xml
@@ -78,7 +78,7 @@
         </item>
         <item>
             <key> <string>factory</string> </key>
-            <value> <string>addCashDelivery</string> </value>
+            <value> <string>addBankingOperation</string> </value>
         </item>
         <item>
             <key> <string>filter_content_types</string> </key>
diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/AccountIncident_getBaobabSource.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/AccountIncident_getBaobabSource.xml
new file mode 100644
index 0000000000..67673d5b3e
--- /dev/null
+++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/AccountIncident_getBaobabSource.xml
@@ -0,0 +1,211 @@
+<?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># first get the source of the document,\n
+# we will need to add the counter\n
+source = context.getSource()\n
+baobab_source = None\n
+context.log(\'baobab_source\', baobab_source)\n
+# Get the history of the workflow\n
+user_id=\'None\'\n
+context.log(\'workflow_item_list:\',context.Base_getWorkflowHistoryItemList(\'check_payment_workflow\',display=0))\n
+for workflow_item in context.Base_getWorkflowHistoryItemList(\'check_payment_workflow\',display=0):\n
+  context.log(\'workflow_item.getProperty(action)\',workflow_item.getProperty(\'action\'))\n
+  if workflow_item.getProperty(\'action\')==\'deliver_action\':\n
+    user_id=workflow_item.getProperty(\'actor\')\n
+context.log(\'user_id\',user_id)\n
+site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)\n
+context.log(\'CheckPayment_getBaobabSource site_list\',site_list)\n
+for site in site_list:\n
+  site_value = context.portal_categories.getCategoryValue(site)\n
+  context.log(\'site\', site)\n
+  if site_value.getVaultType().endswith(\'guichet\') and source in site:\n
+    baobab_source = site + \'/encaisse_des_billets_et_monnaies/sortante\'\n
+    break\n
+  context.log(\'baobab_source\', baobab_source)\n
+  \n
+  \n
+context.log(\'baobab_source\', baobab_source)\n
+return baobab_source\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>**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>0</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>kw</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>source</string>
+                            <string>None</string>
+                            <string>baobab_source</string>
+                            <string>user_id</string>
+                            <string>_getiter_</string>
+                            <string>workflow_item</string>
+                            <string>site_list</string>
+                            <string>site</string>
+                            <string>site_value</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>AccountIncident_getBaobabSource</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_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/AccountIncident_getBaobabSourcePayment.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/AccountIncident_getBaobabSourcePayment.xml
new file mode 100644
index 0000000000..dc76d4d260
--- /dev/null
+++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/AccountIncident_getBaobabSourcePayment.xml
@@ -0,0 +1,177 @@
+<?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 context.Baobab_getPortalDefaultPaymentNode()\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>**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>0</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>kw</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>AccountIncident_getBaobabSourcePayment</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_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/AccountIncident_statSourceCredit.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/AccountIncident_statSourceCredit.xml
new file mode 100644
index 0000000000..ed517853a7
--- /dev/null
+++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/AccountIncident_statSourceCredit.xml
@@ -0,0 +1,156 @@
+<?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>total = 0\n
+for line in context.objectValues(portal_type = context.getPortalAccountingMovementTypeList()) :\n
+  total += line.getSourceCredit()\n
+  \n
+return total\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></string> </value>
+        </item>
+        <item>
+            <key> <string>errors</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_code</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>co_argcount</string> </key>
+                        <value> <int>0</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>total</string>
+                            <string>_getiter_</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>line</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>AccountIncident_statSourceCredit</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/AccountIncident_statSourceDebit.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/AccountIncident_statSourceDebit.xml
new file mode 100644
index 0000000000..e5dc0c0ed0
--- /dev/null
+++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/AccountIncident_statSourceDebit.xml
@@ -0,0 +1,156 @@
+<?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>total = 0\n
+for line in context.objectValues(portal_type = context.getPortalAccountingMovementTypeList()) :\n
+  total += line.getSourceDebit()\n
+  \n
+return total\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></string> </value>
+        </item>
+        <item>
+            <key> <string>errors</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_code</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>co_argcount</string> </key>
+                        <value> <int>0</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>total</string>
+                            <string>_getiter_</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>line</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>AccountIncident_statSourceDebit</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/AccountTransfer_duplicate.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/AccountTransfer_duplicate.xml
new file mode 100644
index 0000000000..d8a8faa5de
--- /dev/null
+++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/AccountTransfer_duplicate.xml
@@ -0,0 +1,230 @@
+<?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[
+
+# We will create a new account transfer and then copy most of local properties\n
+# to the new account transfer created\n
+request=context.REQUEST\n
+portal = context.getPortalObject()\n
+N_ = portal.Base_translateString\n
+\n
+edit_kw = {}\n
+edit_kw[\'delivery_mode\'] = context.getDeliveryMode()\n
+edit_kw[\'source_section\'] = context.getSourceSection()\n
+edit_kw[\'source_payment\'] = context.getSourcePayment()\n
+edit_kw[\'external_software\'] = context.getExternalSoftware()\n
+edit_kw[\'posted\'] = context.getPosted()\n
+edit_kw[\'description\'] = context.getDescription()\n
+\n
+new_transfer = context.account_transfer_module.newContent(**edit_kw)\n
+\n
+message = N_("Account Transfer duplicated.")\n
+if not selection_index:\n
+  redirect_url = \'%s/%s?portal_status_message=%s\' % (new_transfer.absolute_url(),\n
+                                                     form_id,\n
+                                                     message)\n
+else:\n
+  redirect_url = \'%s/%s?selection_index=%s&selection_name=%s&portal_status_message=%s\' % (\n
+                              new_transfer.absolute_url(),\n
+                              form_id,\n
+                              selection_index,\n
+                              selection_name,\n
+                              message)\n
+\n
+return request[\'RESPONSE\'].redirect(redirect_url)\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>form_id, selection_index=0, selection_name=\'\', dialog_id=\'\', ignore_layout=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>5</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>form_id</string>
+                            <string>selection_index</string>
+                            <string>selection_name</string>
+                            <string>dialog_id</string>
+                            <string>ignore_layout</string>
+                            <string>kw</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>request</string>
+                            <string>portal</string>
+                            <string>N_</string>
+                            <string>edit_kw</string>
+                            <string>_write_</string>
+                            <string>_apply_</string>
+                            <string>new_transfer</string>
+                            <string>message</string>
+                            <string>redirect_url</string>
+                            <string>_getitem_</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <tuple>
+                <int>0</int>
+                <string></string>
+                <string></string>
+                <none/>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>AccountTransfer_duplicate</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_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CurrencyPurchase_view/my_source.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CurrencyPurchase_view/my_source.xml
index 1bc0bb3b3d..5b7595ad70 100644
--- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CurrencyPurchase_view/my_source.xml
+++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CurrencyPurchase_view/my_source.xml
@@ -308,7 +308,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:here.Delivery_getVaultItemList(vault_type=[\'site/surface/banque_interne\', \'site/surface/operations_diverses\'], current_url=here.getSource(), user_site=1, leaf_node=0, strict_membership=1)</string> </value>
+            <value> <string>python:here.Delivery_getVaultItemList(vault_type=[\'site/surface/banque_interne\', \'site/surface/operations_diverses\',  \'site/surface/gros_versement\'], current_url=here.getSource(), user_site=1, leaf_node=0, strict_membership=1)</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CurrencySale_view/my_source.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CurrencySale_view/my_source.xml
index 1bc0bb3b3d..a20d83ab41 100644
--- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CurrencySale_view/my_source.xml
+++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CurrencySale_view/my_source.xml
@@ -308,7 +308,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:here.Delivery_getVaultItemList(vault_type=[\'site/surface/banque_interne\', \'site/surface/operations_diverses\'], current_url=here.getSource(), user_site=1, leaf_node=0, strict_membership=1)</string> </value>
+            <value> <string>python:here.Delivery_getVaultItemList(vault_type=[\'site/surface/banque_interne\', \'site/surface/operations_diverses\',\'site/surface/gros_paiement\'], current_url=here.getSource(), user_site=1, leaf_node=0, strict_membership=1)</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/ForeignCashReception_view/my_resource.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/ForeignCashReception_view/my_resource.xml
index db7ec5d865..924430e85c 100644
--- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/ForeignCashReception_view/my_resource.xml
+++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/ForeignCashReception_view/my_resource.xml
@@ -281,7 +281,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python: here.CurrencyExchange_getCurrencyList()</string> </value>
+            <value> <string>python: here.CurrencyExchange_getCurrencyList(exclude_reference_currency=1)</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MonetaryDestruction_view/my_source_section.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MonetaryDestruction_view/my_source_section.xml
index 317cb1c940..386092a621 100644
--- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MonetaryDestruction_view/my_source_section.xml
+++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MonetaryDestruction_view/my_source_section.xml
@@ -281,7 +281,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:here.Delivery_getVaultItemList(vault_type = \'site\', current_url = None, user_site = None, leaf_node = 0, strict_membership = 1)</string> </value>
+            <value> <string>python:here.Delivery_getVaultItemList(vault_type = \'site\', current_url = None, user_site = None, leaf_node = 0, strict_membership = 1,main_agency=1)</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MonetaryIssue_fastInputForm/listbox.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MonetaryIssue_fastInputForm/listbox.xml
index e1e064d302..95effc4063 100644
--- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MonetaryIssue_fastInputForm/listbox.xml
+++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MonetaryIssue_fastInputForm/listbox.xml
@@ -349,6 +349,10 @@
                           <string>cash_number_range_stop</string>
                           <string>End Number</string>
                         </tuple>
+                        <tuple>
+                          <string>date</string>
+                          <string>Reception Date</string>
+                        </tuple>
                         <tuple>
                           <string>resource_translated_title</string>
                           <string>Denomination</string>
diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MonetaryIssue_viewCashContainerInputDialog.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MonetaryIssue_viewCashContainerInputDialog.xml
index fde24e1a58..7474c82b7f 100644
--- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MonetaryIssue_viewCashContainerInputDialog.xml
+++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MonetaryIssue_viewCashContainerInputDialog.xml
@@ -80,13 +80,13 @@ if listbox is None:\n
   listbox = []\n
   #context.log("tracking list", context.portal_simulation.getCurrentTrackingList(at_date= reference_date, node = node))\n
   for o in context.portal_simulation.getCurrentTrackingList(at_date= reference_date, node = node):\n
-    if o.getObject().getParentValue().getPortalType()  in container_portal_type_list:\n
-      cash_container = o.getObject()\n
+    cash_container = o.getObject()\n
+    if cash_container.getParentValue().getPortalType()  in container_portal_type_list:\n
       # get one line in order to know some properties of the cash container\n
       container_dict = {}\n
       container_lines = cash_container.searchFolder(portal_type=\'Container Line\')\n
       if len(container_lines) == 0:\n
-        context.log("MonetaryIssue_generateCashContainerInputDialog", "No container line finf for cash container %s" %(cash_container.getRelativeUrl(),))\n
+        context.log("MonetaryIssue_generateCashContainerInputDialog", "No container line find for cash container %s" %(cash_container.getRelativeUrl(),))\n
         continue\n
       container_line = container_lines[0].getObject()\n
       container_dict[\'reference\'] = cash_container.getReference()\n
@@ -96,9 +96,18 @@ if listbox is None:\n
       container_dict[\'quantity\'] = container_line.getQuantity()\n
       container_dict[\'total_price\'] = container_line.getTotalPrice()\n
       container_dict[\'selection\'] = 0\n
+      container_dict[\'date\'] = o.date\n
       container_dict[\'uid\'] = \'new_%s\' %(cash_container.getUid(),)   #cash_container.getReference().replace(\'/\', \'_\'),)\n
 \n
       listbox.append(container_dict)\n
+\n
+  def sort_listbox(a,b):\n
+    result = cmp(a[\'date\'],b[\'date\'])\n
+    if result == 0:\n
+      result = cmp(a[\'reference\'],b[\'reference\'])\n
+    return result\n
+\n
+  listbox.sort(sort_listbox)\n
 \n
   context.Base_updateDialogForm(listbox=listbox\n
                                 )\n
@@ -180,6 +189,7 @@ if listbox is None:\n
                             <string>_getitem_</string>
                             <string>container_line</string>
                             <string>_write_</string>
+                            <string>sort_listbox</string>
                             <string>_apply_</string>
                           </tuple>
                         </value>
diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MonetaryReception_view/listbox.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MonetaryReception_view/listbox.xml
index af0fff3387..3386720a45 100644
--- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MonetaryReception_view/listbox.xml
+++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MonetaryReception_view/listbox.xml
@@ -445,6 +445,10 @@
                       <list/>
                     </value>
                 </item>
+                <item>
+                    <key> <string>page_template</string> </key>
+                    <value> <string></string> </value>
+                </item>
                 <item>
                     <key> <string>portal_types</string> </key>
                     <value>
@@ -486,7 +490,7 @@
                 </item>
                 <item>
                     <key> <string>selection_name</string> </key>
-                    <value> <string></string> </value>
+                    <value> <string>monetary_reception_delivery_line_list_selection</string> </value>
                 </item>
                 <item>
                     <key> <string>sort</string> </key>
diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MoneyDeposit_getBaobabDestination.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MoneyDeposit_getBaobabDestination.xml
index 1c28f3f7bb..72877bd41a 100644
--- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MoneyDeposit_getBaobabDestination.xml
+++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MoneyDeposit_getBaobabDestination.xml
@@ -71,7 +71,7 @@
             <value> <string>destination = context.getDestination()\n
 baobab_destination = None\n
 # Get the history of the workflow\n
-user_id=\'None\'\n
+user_id=None\n
 for workflow_item in context.Base_getWorkflowHistoryItemList(\'money_deposit_workflow\',display=0):\n
   if workflow_item.getProperty(\'action\')==\'deliver_action\':\n
     user_id=workflow_item.getProperty(\'actor\')\n
@@ -81,6 +81,10 @@ for site in site_list:\n
   if site_value.getVaultType().endswith(\'guichet\') and destination in site:\n
     baobab_destination = site + \'/encaisse_des_billets_et_monnaies/entrante\'\n
     break\n
+if user_id is not None and baobab_destination is None:\n
+  from Products.ERP5Type.Message import Message\n
+  message = Message(domain="ui", message="The owner is not assigned to the right vault.")\n
+  raise ValueError,message\n
 return baobab_destination\n
 </string> </value>
         </item>
@@ -149,6 +153,10 @@ return baobab_destination\n
                             <string>site_list</string>
                             <string>site</string>
                             <string>site_value</string>
+                            <string>Products.ERP5Type.Message</string>
+                            <string>Message</string>
+                            <string>message</string>
+                            <string>ValueError</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MoneyDeposit_view/my_destination.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MoneyDeposit_view/my_destination.xml
index 67be989e96..6610b1b833 100644
--- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MoneyDeposit_view/my_destination.xml
+++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MoneyDeposit_view/my_destination.xml
@@ -287,7 +287,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:here.Delivery_getVaultItemList(vault_type=[\'site/surface/banque_interne\', \'site/surface/operations_diverses\', \'site/surface/gros_paiement\'], current_url=here.getSource(), user_site=1, leaf_node=0, strict_membership=1)</string> </value>
+            <value> <string>python:here.Delivery_getVaultItemList(vault_type=[\'site/surface/banque_interne\', \'site/surface/operations_diverses\', \'site/surface/gros_versement\'], current_url=here.getSource(), user_site=1, leaf_node=0, strict_membership=1)</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/UsualCashIncident_view/my_source_transport.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/UsualCashIncident_view/my_source_transport.xml
index c98b43f7a6..294505070a 100644
--- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/UsualCashIncident_view/my_source_transport.xml
+++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/UsualCashIncident_view/my_source_transport.xml
@@ -287,7 +287,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python: here.Delivery_getVaultItemList(user_site=0,vault_type=(\'site\',),strict_membership=1,leaf_node=0,with_base=0)</string> </value>
+            <value> <string>python: here.Delivery_getVaultItemList(user_site=0,vault_type=(\'site\',),strict_membership=1,leaf_node=0,with_base=0,exclude_user_site=1)</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/scripts/checkConsistency.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/scripts/checkConsistency.xml
index f16854ac85..fc7fc465ab 100644
--- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/scripts/checkConsistency.xml
+++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/scripts/checkConsistency.xml
@@ -89,7 +89,8 @@ elif len(in_list) == 0 and len(out_list) == 0:\n
   msg = Message(domain = "ui", message="No resource.")\n
   raise ValidationFailed, (msg,)\n
 elif len(out_list) !=0:\n
-  resource = transaction.CashDelivery_checkCounterInventory(source=vault, portal_type=\'Outgoing Account Incident Line\')\n
+  #resource = transaction.CashDelivery_checkCounterInventory(source=vault, portal_type=\'Outgoing Account Incident Line\')\n
+  resource = txn.CashDelivery_checkCounterInventory(source=vault, portal_type=\'Outgoing Account Incident Line\')\n
   if resource <> 0 :\n
     msg = Message(domain="ui", message="Insufficient Balance.")\n
     raise ValidationFailed, (msg,)\n
@@ -162,7 +163,6 @@ elif (in_price != 0 and in_price != price) or (out_price != 0 and out_price != p
                             <string>out_price</string>
                             <string>len</string>
                             <string>msg</string>
-                            <string>transaction</string>
                             <string>resource</string>
                           </tuple>
                         </value>
diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_sorting_workflow/scripts/validateBalance.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_sorting_workflow/scripts/validateBalance.xml
index 6d6357082c..1176614bf7 100644
--- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_sorting_workflow/scripts/validateBalance.xml
+++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_sorting_workflow/scripts/validateBalance.xml
@@ -73,6 +73,13 @@ from Products.ERP5Type.Message import Message\n
 \n
 # Purchase Transaction .\n
 transaction = state_change.object\n
+\n
+# use of the constraint : Test if quantity is multiple of 1000\n
+vliste = transaction.checkConsistency()\n
+transaction.log(\'vliste\', vliste)\n
+if len(vliste) != 0:\n
+  raise ValidationFailed, (vliste[0].getMessage(),)\n
+\n
 # Get inventory\n
 vault = transaction.getSource()\n
 resource =  transaction.CashDelivery_checkCounterInventory(source=vault, portal_type=\'Incoming Cash Sorting Line\')\n
@@ -152,6 +159,9 @@ elif resource != 0 :\n
                             <string>Message</string>
                             <string>_getattr_</string>
                             <string>transaction</string>
+                            <string>vliste</string>
+                            <string>len</string>
+                            <string>_getitem_</string>
                             <string>vault</string>
                             <string>resource</string>
                             <string>price</string>
diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/currency_sale_workflow/scripts/validatePositionAccounting.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/currency_sale_workflow/scripts/validatePositionAccounting.xml
index cad80821ac..bc3cf70192 100644
--- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/currency_sale_workflow/scripts/validatePositionAccounting.xml
+++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/currency_sale_workflow/scripts/validatePositionAccounting.xml
@@ -108,7 +108,7 @@ context.BankingOperationLine_index(line)\n
 bank_account.serialize()\n
 \n
 # Check if the banking operation is correct.\n
-if - price != transaction.getTotalPrice(portal_type = \'Banking Operation Line\'):\n
+if - price != transaction.getTotalPrice(portal_type = \'Banking Operation Line\',fast=0):\n
   msg = Message(domain=\'ui\', message=\'Banking operation and currency sale price do not match.\')\n
   raise ValidationFailed, (msg,)\n
 \n
diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/currency_sale_workflow/transitions/plan.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/currency_sale_workflow/transitions/plan.xml
index c2c3e6b886..c3c612c183 100644
--- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/currency_sale_workflow/transitions/plan.xml
+++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/currency_sale_workflow/transitions/plan.xml
@@ -58,7 +58,7 @@
         </item>
         <item>
             <key> <string>title</string> </key>
-            <value> <string>Currency Sale Consistency</string> </value>
+            <value> <string>Control</string> </value>
         </item>
         <item>
             <key> <string>trigger_type</string> </key>
diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/currency_sale_workflow/transitions/plan_action.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/currency_sale_workflow/transitions/plan_action.xml
index c6be7ba7e2..0e06d967e9 100644
--- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/currency_sale_workflow/transitions/plan_action.xml
+++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/currency_sale_workflow/transitions/plan_action.xml
@@ -24,7 +24,7 @@
         </item>
         <item>
             <key> <string>actbox_name</string> </key>
-            <value> <string>Currency Sale Consistency</string> </value>
+            <value> <string>Control</string> </value>
         </item>
         <item>
             <key> <string>actbox_url</string> </key>
@@ -58,7 +58,7 @@
         </item>
         <item>
             <key> <string>title</string> </key>
-            <value> <string>Currency Sale Consistency</string> </value>
+            <value> <string>Control</string> </value>
         </item>
         <item>
             <key> <string>trigger_type</string> </key>
diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/monetary_issue_workflow/scripts/validateVaultBalance.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/monetary_issue_workflow/scripts/validateVaultBalance.xml
index 1e53ebe1fb..143f96a608 100644
--- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/monetary_issue_workflow/scripts/validateVaultBalance.xml
+++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/monetary_issue_workflow/scripts/validateVaultBalance.xml
@@ -75,6 +75,12 @@ from Products.ERP5Type.Message import Message\n
 \n
 transaction = state_change.object\n
 \n
+# use of the constraint\n
+vliste = transaction.checkConsistency()\n
+transaction.log(\'vliste\', vliste)\n
+if len(vliste) != 0:\n
+  raise ValidationFailed, (vliste[0].getMessage(),)\n
+\n
 vault = transaction.getSource()\n
 resource = transaction.CashDelivery_checkCounterInventory(source=vault, portal_type=\'Monetary Issue Line\')\n
 \n
@@ -154,6 +160,9 @@ elif resource <> 0 :\n
                             <string>Message</string>
                             <string>_getattr_</string>
                             <string>transaction</string>
+                            <string>vliste</string>
+                            <string>len</string>
+                            <string>_getitem_</string>
                             <string>vault</string>
                             <string>resource</string>
                             <string>amount</string>
diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/monetary_reception_workflow/scripts/checkDestination.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/monetary_reception_workflow/scripts/checkDestination.xml
index c5ba7a3841..f58e848d5f 100644
--- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/monetary_reception_workflow/scripts/checkDestination.xml
+++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/monetary_reception_workflow/scripts/checkDestination.xml
@@ -72,6 +72,14 @@
 from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
 \n
 object = state_change.object\n
+\n
+# use of the constraint\n
+vliste = object.checkConsistency()\n
+object.log(\'vliste\', vliste)\n
+if len(vliste) != 0:\n
+  raise ValidationFailed, (vliste[0].getMessage(),)\n
+\n
+\n
 # first check if we have line defined\n
 if len(object.objectValues(portal_type=\'Cash Delivery Line\')) == 0:\n
   msg = Message(domain="ui", message="No line defined on document.")\n
@@ -83,10 +91,13 @@ if \'encaisse_des_billets_retires_de_la_circulation\' in dest.getRelativeUrl():\
   raise ValidationFailed, (msg,)\n
 \n
 # check between letter and destination site codification\n
-line_letter = object.objectValues(portal_type=\'Cash Delivery Line\')[0].objectValues()[0].getEmissionLetter()\n
-if line_letter.lower() != dest.getCodification()[0].lower():\n
-  msg = Message(domain="ui", message="Letter defined on line do not correspond to destination site.")\n
-  raise ValidationFailed, (msg,)\n
+# Make sure objects are Banknotes\n
+first_movement = object.Delivery_getMovementList(portal_type=[\'Cash Delivery Line\',\'Cash Delivery Cell\'])[0]\n
+if first_movement.getResourceValue().getPortalType()==\'Banknote\':\n
+  line_letter = first_movement.getEmissionLetter()\n
+  if line_letter.lower() != dest.getCodification()[0].lower():\n
+    msg = Message(domain="ui", message="Letter defined on line do not correspond to destination site.")\n
+    raise ValidationFailed, (msg,)\n
 </string> </value>
         </item>
         <item>
@@ -142,10 +153,12 @@ if line_letter.lower() != dest.getCodification()[0].lower():\n
                             <string>ValidationFailed</string>
                             <string>_getattr_</string>
                             <string>object</string>
+                            <string>vliste</string>
                             <string>len</string>
+                            <string>_getitem_</string>
                             <string>msg</string>
                             <string>dest</string>
-                            <string>_getitem_</string>
+                            <string>first_movement</string>
                             <string>line_letter</string>
                           </tuple>
                         </value>
diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/money_deposit_workflow/scripts/validateVaultBalance.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/money_deposit_workflow/scripts/validateVaultBalance.xml
index 161cc43103..60a2353d8a 100644
--- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/money_deposit_workflow/scripts/validateVaultBalance.xml
+++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/money_deposit_workflow/scripts/validateVaultBalance.xml
@@ -90,11 +90,6 @@ elif resource == 2:\n
 elif price != cash_detail:\n
   msg = Message(domain="ui", message="Amount differs from input.")\n
   raise ValidationFailed, (msg,)\n
-"""\n
-elif resource == 1:\n
-  msg = Message(domain="ui", message="Insufficient Balance in counter.")\n
-  raise ValidationFailed, (msg,)\n
-"""\n
 </string> </value>
         </item>
         <item>
diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/vault_transfer_workflow/scripts/validateVaultBalance.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/vault_transfer_workflow/scripts/validateVaultBalance.xml
index e1b5f0ae81..0997b41b54 100644
--- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/vault_transfer_workflow/scripts/validateVaultBalance.xml
+++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/vault_transfer_workflow/scripts/validateVaultBalance.xml
@@ -78,6 +78,12 @@ date = transaction.getStartDate()\n
 vault = transaction.getSource()\n
 vaultDestination = transaction.getDestination()\n
 \n
+# use of the constraint : Test source and destination\n
+vliste = transaction.checkConsistency()\n
+transaction.log(\'vliste\', vliste)\n
+if len(vliste) != 0:\n
+  raise ValidationFailed, (vliste[0].getMessage(),)\n
+\n
 # check we are in an opened accounting day\n
 if not transaction.Baobab_checkCounterDateOpen(site=vaultDestination, date=date):\n
   msg = Message(domain = "ui", message="Counter Date is not opened")\n
@@ -165,6 +171,9 @@ elif resource <> 0 :\n
                             <string>date</string>
                             <string>vault</string>
                             <string>vaultDestination</string>
+                            <string>vliste</string>
+                            <string>len</string>
+                            <string>_getitem_</string>
                             <string>msg</string>
                             <string>resource</string>
                             <string>amount</string>
diff --git a/bt5/erp5_banking_cash/bt/revision b/bt5/erp5_banking_cash/bt/revision
index 1bda760653..afbe847262 100644
--- a/bt5/erp5_banking_cash/bt/revision
+++ b/bt5/erp5_banking_cash/bt/revision
@@ -1 +1 @@
-117
\ No newline at end of file
+126
\ No newline at end of file
-- 
2.30.9