From 4b9df912993425a8911fcb73a48f0013938dab77 Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Tue, 22 May 2007 21:32:59 +0000
Subject: [PATCH] finish changes on check payment in order to support the new
 way of checking references

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14556 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../scripts/updateBankingOperation.xml                | 11 ++++-------
 .../scripts/validateConsistency.xml                   |  4 +++-
 bt5/erp5_banking_check/bt/revision                    |  2 +-
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/updateBankingOperation.xml b/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/updateBankingOperation.xml
index cf7ba29464..84aba5f209 100644
--- a/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/updateBankingOperation.xml
+++ b/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/updateBankingOperation.xml
@@ -74,17 +74,15 @@ transaction = state_change[\'object\']\n
 bank_account = transaction.getDestinationPaymentValue()\n
 check_number = transaction.getAggregateFreeText()\n
 \n
-\n
-check = transaction.Base_checkOrCreateCheck(reference=check_number)\n
-if not check.Check_isValid():\n
-  raise ValidationFailed, Message(domain=\'ui\', message=\'Check is in an invalid state\')\n
+# Already done before in validateConsistency\n
+#check = transaction.Base_checkOrCreateCheck(reference=check_number)\n
+#if not check.Check_isValid():\n
+#  raise ValidationFailed, Message(domain=\'ui\', message=\'Check is in an invalid state\')\n
 \n
 line = transaction.get(\'movement\')\n
 if line is not None and line.getPortalType() == \'Banking Operation Line\':\n
   # This is a single currency operation, so it is not necessary to convert the price.\n
   line.setSourceDebit(transaction.getSourceTotalAssetPrice())\n
-\n
-transaction.edit(aggregate = check.getRelativeUrl())\n
 </string> </value>
         </item>
         <item>
@@ -151,7 +149,6 @@ transaction.edit(aggregate = check.getRelativeUrl())\n
                             <string>_getattr_</string>
                             <string>bank_account</string>
                             <string>check_number</string>
-                            <string>check</string>
                             <string>line</string>
                             <string>None</string>
                           </tuple>
diff --git a/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/validateConsistency.xml b/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/validateConsistency.xml
index 0dea306ee3..4e6c06f52c 100644
--- a/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/validateConsistency.xml
+++ b/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/validateConsistency.xml
@@ -129,8 +129,9 @@ if check_resource is None:\n
   msg = Message(domain=\'ui\', message="Check type not defined.")\n
   raise ValidationFailed, (msg,)\n
 \n
-transaction.Base_checkCheck(reference=check_number, bank_account=bank_account, \n
+check = transaction.Base_checkCheck(reference=check_number, bank_account=bank_account, \n
                             resource=check_resource)\n
+transaction.edit(aggregate=check.getRelativeUrl())\n
 \n
 context.updateBankingOperation(state_change)\n
 
@@ -213,6 +214,7 @@ context.updateBankingOperation(state_change)\n
                             <string>bank_account</string>
                             <string>check_number</string>
                             <string>check_resource</string>
+                            <string>check</string>
                             <string>context</string>
                           </tuple>
                         </value>
diff --git a/bt5/erp5_banking_check/bt/revision b/bt5/erp5_banking_check/bt/revision
index bcad85486c..37c3b662e1 100644
--- a/bt5/erp5_banking_check/bt/revision
+++ b/bt5/erp5_banking_check/bt/revision
@@ -1 +1 @@
-225
\ No newline at end of file
+227
\ No newline at end of file
-- 
2.30.9