From 27e654972b2a9e70d6ebed747274f93e6b6f641c Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Mon, 19 Mar 2007 12:16:13 +0000
Subject: [PATCH] Add more portal types and simulation states to ignore when
 closing a counter date.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13503 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../CounterDate_getRemainingOperationList.xml      | 14 +++++++++++++-
 bt5/erp5_banking_core/bt/revision                  |  2 +-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CounterDate_getRemainingOperationList.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CounterDate_getRemainingOperationList.xml
index 6d92ad2af3..c46e14511d 100644
--- a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CounterDate_getRemainingOperationList.xml
+++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CounterDate_getRemainingOperationList.xml
@@ -85,7 +85,16 @@ if site_uid is not None:\n
   append = operation_list.append\n
   for document in document_list:\n
     # Stop Payment and Cash Movement in started state must not block counter day closing.\n
-    if not (document.getPortalType() in (\'Stop Payment\', \'Cash Movement\') and document.getSimulationState()==\'started\'):\n
+    # Mutilated Banknotes in planned state or in finished state with siege as source must nogt block either.\n
+    portal_type = document.getPortalType()\n
+    simulation_state = document.getSimulationState()\n
+    if not (   (portal_type in (\'Stop Payment\', \'Cash Movement\') and simulation_state == \'started\')\n
+            or (portal_type == \'Mutilated Banknote\' and \n
+                 (simulation_state == \'planned\' or \n
+                   (simulation_state == \'finished\' and \'siege\' in here.getSource(\'\'))\n
+                 )\n
+               )\n
+           ):\n
       append(document)\n
 \n
 def operation_sort(a,b):\n
@@ -161,6 +170,9 @@ return operation_list\n
                             <string>portal_type_list</string>
                             <string>document_list</string>
                             <string>document</string>
+                            <string>portal_type</string>
+                            <string>simulation_state</string>
+                            <string>here</string>
                             <string>operation_sort</string>
                           </tuple>
                         </value>
diff --git a/bt5/erp5_banking_core/bt/revision b/bt5/erp5_banking_core/bt/revision
index c663e4d093..2d73b5e3ba 100644
--- a/bt5/erp5_banking_core/bt/revision
+++ b/bt5/erp5_banking_core/bt/revision
@@ -1 +1 @@
-151
\ No newline at end of file
+152
\ No newline at end of file
-- 
2.30.9