[Erp5-report] r19164 - in /erp5/trunk/bt5/erp5_banking_check: WorkflowTemplateItem/portal_w...

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Feb 8 11:49:58 CET 2008


Author: aurel
Date: Fri Feb  8 11:49:57 2008
New Revision: 19164

URL: http://svn.erp5.org?rev=19164&view=rev
Log:
if we have the same account on multiple check line, sum their amount to check balance

Modified:
    erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_deposit_workflow/scripts/checkCheckBeforeDelivery.xml
    erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_deposit_workflow/scripts/validateConsistency.xml
    erp5/trunk/bt5/erp5_banking_check/bt/revision

Modified: erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_deposit_workflow/scripts/checkCheckBeforeDelivery.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_deposit_workflow/scripts/checkCheckBeforeDelivery.xml?rev=19164&r1=19163&r2=19164&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_deposit_workflow/scripts/checkCheckBeforeDelivery.xml (original)
+++ erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_deposit_workflow/scripts/checkCheckBeforeDelivery.xml Fri Feb  8 11:49:57 2008
@@ -83,6 +83,8 @@
     manual_validation = 1\n
     break\n
 \n
+bank_account_dict = {}\n
+\n
 if manual_validation:\n
   return\n
 else:\n
@@ -90,7 +92,14 @@
   for check_operation_line in obj.contentValues(filter = {\'portal_type\' : \'Check Operation Line\'}):\n
     source_bank_account = check_operation_line.getSourcePaymentValue()\n
     # Test if the account balance is sufficient.\n
-    error = context.BankAccount_checkBalance(source_bank_account.getRelativeUrl(), check_operation_line.getPrice())\n
+    account_path = source_bank_account.getRelativeUrl()\n
+    if bank_account_dict.has_key(account_path):\n
+      check_price = bank_account_dict[account_path] + check_operation_line.getPrice()      \n
+    else:\n
+      check_price = check_operation_line.getPrice()\n
+    bank_account_dict[account_path] = check_price\n
+    error = context.BankAccount_checkBalance(account_path, check_operation_line.getPrice())\n
+    \n
     if error[\'error_code\'] == 1:\n
       msg = Message(domain=\'ui\', message="Bank account $account is not sufficient on line $line.",\n
                     mapping={"account": source_bank_account.getInternalBankAccountNumber(), "line" : check_operation_line.getId()})\n
@@ -168,8 +177,12 @@
                             <string>_getiter_</string>
                             <string>h</string>
                             <string>manual_validation</string>
+                            <string>bank_account_dict</string>
                             <string>check_operation_line</string>
                             <string>source_bank_account</string>
+                            <string>account_path</string>
+                            <string>check_price</string>
+                            <string>_write_</string>
                             <string>context</string>
                             <string>error</string>
                             <string>msg</string>

Modified: erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_deposit_workflow/scripts/validateConsistency.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_deposit_workflow/scripts/validateConsistency.xml?rev=19164&r1=19163&r2=19164&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_deposit_workflow/scripts/validateConsistency.xml (original)
+++ erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_deposit_workflow/scripts/validateConsistency.xml Fri Feb  8 11:49:57 2008
@@ -111,6 +111,8 @@
   context.checkAccountIsOverdraftFacility(state_change)\n
     \n
 \n
+bank_account_dict = {}\n
+\n
 # Check each check operation line.\n
 for check_operation_line in transaction.contentValues(filter = {\'portal_type\' : \'Check Operation Line\'}):\n
 \n
@@ -147,7 +149,13 @@
   \n
   # Test if the account balance is sufficient.\n
   if state_change[\'transition\'].getId() == "plan_action":\n
-    error = context.BankAccount_checkBalance(source_bank_account.getRelativeUrl(), check_operation_line.getPrice())\n
+    account_path = source_bank_account.getRelativeUrl()\n
+    if bank_account_dict.has_key(account_path):\n
+      check_price = bank_account_dict[account_path] + check_operation_line.getPrice()      \n
+    else:\n
+      check_price = check_operation_line.getPrice()\n
+    bank_account_dict[account_path] = check_price\n
+    error = context.BankAccount_checkBalance(account_path, check_operation_line.getPrice())\n
     if error[\'error_code\'] == 1:\n
       msg = Message(domain=\'ui\', message="Bank account $account is not sufficient on line $line.",\n
                     mapping={"account": source_bank_account.getInternalBankAccountNumber(), "line" : check_operation_line.getId()})\n
@@ -236,11 +244,15 @@
                             <string>price</string>
                             <string>destination_bank_account</string>
                             <string>context</string>
+                            <string>bank_account_dict</string>
                             <string>_getiter_</string>
                             <string>check_operation_line</string>
                             <string>check_number</string>
                             <string>check_type</string>
                             <string>source_bank_account</string>
+                            <string>account_path</string>
+                            <string>check_price</string>
+                            <string>_write_</string>
                             <string>error</string>
                             <string>check</string>
                           </tuple>

Modified: erp5/trunk/bt5/erp5_banking_check/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_check/bt/revision?rev=19164&r1=19163&r2=19164&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_banking_check/bt/revision (original)
+++ erp5/trunk/bt5/erp5_banking_check/bt/revision Fri Feb  8 11:49:57 2008
@@ -1,1 +1,1 @@
-380
+382




More information about the Erp5-report mailing list