[Erp5-report] r18953 - in /erp5/trunk/bt5/erp5_banking_check: WorkflowTemplateItem/portal_w...
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Jan 31 17:45:11 CET 2008
Author: aurel
Date: Thu Jan 31 17:45:11 2008
New Revision: 18953
URL: http://svn.erp5.org?rev=18953&view=rev
Log:
add more check for manual validation
Modified:
erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/checkAccountIsOverdraftFacility.xml
erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/validatePositionAccounting.xml
erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/transitions/agree_action.xml
erp5/trunk/bt5/erp5_banking_check/bt/revision
Modified: erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/checkAccountIsOverdraftFacility.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/checkAccountIsOverdraftFacility.xml?rev=18953&r1=18952&r2=18953&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/checkAccountIsOverdraftFacility.xml (original)
+++ erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/checkAccountIsOverdraftFacility.xml Thu Jan 31 17:45:11 2008
@@ -68,12 +68,44 @@
<value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from Products.ERP5Type.Message import Message\n
\n
-txn = state_change[\'object\']\n
+transaction = state_change[\'object\']\n
+date = transaction.getStartDate()\n
+source = transaction.getSource(None)\n
+if source is None:\n
+ msg = Message(domain=\'ui\', message=\'No counter defined.\')\n
+ raise ValidationFailed, (msg,)\n
\n
-account = txn.getDestinationPaymentValue()\n
+# check we are in an opened accounting day\n
+transaction.Baobab_checkCounterDateOpen(site=source, date=date)\n
\n
-if not account.isOverdraftFacility():\n
- msg = Message(domain=\'ui\', message="Can\'t sent to manual validation because of not averdraft facility for this bank account")\n
+site = transaction.getSourceValue()\n
+\n
+# For safety, check the consistency again.\n
+context.validateConsistency(state_change)\n
+\n
+line = transaction.movement\n
+bank_account = transaction.getDestinationPaymentValue()\n
+\n
+if not bank_account.isOverdraftFacility():\n
+ msg = Message(domain=\'ui\', message="Can\'t sent to manual validation because of not overdraft facility for this bank account")\n
+ raise ValidationFailed, (msg,)\n
+\n
+price = transaction.getSourceTotalAssetPrice()\n
+\n
+# this prevents multiple transactions from being committed at the same time for this bank account.\n
+bank_account.serialize()\n
+\n
+# Make sure there are no other operations pending for this account\n
+if transaction.BankAccount_isMessagePending(bank_account):\n
+ msg = Message(domain=\'ui\', message="There are operations pending for this account that prevent form calculating its position. Please try again later.")\n
+ raise ValidationFailed, (msg,)\n
+\n
+# Index the banking operation line so it impacts account position\n
+transaction.BankingOperationLine_index(line)\n
+\n
+# Check if the banking operation is correct. Do not depend on catalog because line might not be indexed immediatelly.\n
+if - price != (line.getPrice() * line.getQuantity()):\n
+ msg = Message(domain=\'ui\', message=\'Banking operation and check payment price do not match.\')\n
raise ValidationFailed, (msg,)\n
</string> </value>
</item>
@@ -123,10 +155,17 @@
<string>Products.ERP5Type.Message</string>
<string>Message</string>
<string>_getitem_</string>
- <string>txn</string>
+ <string>transaction</string>
<string>_getattr_</string>
- <string>account</string>
+ <string>date</string>
+ <string>None</string>
+ <string>source</string>
<string>msg</string>
+ <string>site</string>
+ <string>context</string>
+ <string>line</string>
+ <string>bank_account</string>
+ <string>price</string>
</tuple>
</value>
</item>
Modified: erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/validatePositionAccounting.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/validatePositionAccounting.xml?rev=18953&r1=18952&r2=18953&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/validatePositionAccounting.xml (original)
+++ erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/validatePositionAccounting.xml Thu Jan 31 17:45:11 2008
@@ -106,16 +106,17 @@
raise ValidationFailed, (msg,)\n
\n
# Test if the account balance is sufficient.\n
-error = transaction.BankAccount_checkAvailableBalance(bank_account.getRelativeUrl(), price)\n
-if error[\'error_code\'] == 1:\n
- msg = Message(domain=\'ui\', message="Bank account is not sufficient.")\n
- raise ValidationFailed, (msg,)\n
-elif error[\'error_code\'] == 2:\n
- msg = Message(domain=\'ui\', message="Bank account is not valid.")\n
- raise ValidationFailed, (msg,)\n
-elif error[\'error_code\'] != 0:\n
- msg = Message(domain=\'ui\', message="Unknown error code.")\n
- raise ValidationFailed, (msg,)\n
+if state_change[\'transition\'].getId() != "agree_action":\n
+ error = transaction.BankAccount_checkAvailableBalance(bank_account.getRelativeUrl(), price)\n
+ if error[\'error_code\'] == 1:\n
+ msg = Message(domain=\'ui\', message="Bank account is not sufficient.")\n
+ raise ValidationFailed, (msg,)\n
+ elif error[\'error_code\'] == 2:\n
+ msg = Message(domain=\'ui\', message="Bank account is not valid.")\n
+ raise ValidationFailed, (msg,)\n
+ elif error[\'error_code\'] != 0:\n
+ msg = Message(domain=\'ui\', message="Unknown error code.")\n
+ raise ValidationFailed, (msg,)\n
</string> </value>
</item>
<item>
Modified: erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/transitions/agree_action.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/transitions/agree_action.xml?rev=18953&r1=18952&r2=18953&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/transitions/agree_action.xml (original)
+++ erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/transitions/agree_action.xml Thu Jan 31 17:45:11 2008
@@ -51,7 +51,7 @@
</item>
<item>
<key> <string>script_name</string> </key>
- <value> <string></string> </value>
+ <value> <string>validatePositionAccounting</string> </value>
</item>
<item>
<key> <string>title</string> </key>
Modified: erp5/trunk/bt5/erp5_banking_check/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_check/bt/revision?rev=18953&r1=18952&r2=18953&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_banking_check/bt/revision (original)
+++ erp5/trunk/bt5/erp5_banking_check/bt/revision Thu Jan 31 17:45:11 2008
@@ -1,1 +1,1 @@
-369
+370
More information about the Erp5-report
mailing list