Commit 5d2181dc authored by Aurel's avatar Aurel

when sending to manual validation, we must control all the document as if it's...

when sending to manual validation, we must control all the document as if it's usual way except account inventory

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18950 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b3e4727a
...@@ -70,10 +70,16 @@ from Products.ERP5Type.Message import Message\n ...@@ -70,10 +70,16 @@ from Products.ERP5Type.Message import Message\n
\n \n
txn = state_change[\'object\']\n txn = state_change[\'object\']\n
\n \n
account = txn.getDestinationPaymentValue()\n for line in txn.contentValues(filter = {\'portal_type\' : \'Check Operation Line\'}):\n
\n
account = line.getSourcePaymentValue()\n
\n \n
if not account.isOverdraftFacility():\n if account is None:\n
msg = Message(domain=\'ui\', message="Can\'t sent to manual validation because of not averdraft facility for this bank account")\n msg = Message(domain=\'ui\', message="No account defined on line")\n
raise ValidationFailed, (msg,)\n
\n
if not 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 raise ValidationFailed, (msg,)\n
</string> </value> </string> </value>
</item> </item>
...@@ -130,8 +136,11 @@ if not account.isOverdraftFacility():\n ...@@ -130,8 +136,11 @@ if not account.isOverdraftFacility():\n
<string>Message</string> <string>Message</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>txn</string> <string>txn</string>
<string>_getiter_</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>line</string>
<string>account</string> <string>account</string>
<string>None</string>
<string>msg</string> <string>msg</string>
</tuple> </tuple>
</value> </value>
......
...@@ -106,6 +106,11 @@ if transaction.getTotalPrice(fast=0, portal_type = \'Check Operation Line\') != ...@@ -106,6 +106,11 @@ if transaction.getTotalPrice(fast=0, portal_type = \'Check Operation Line\') !=
msg = Message(domain=\'ui\', message="Total price doesn\'t match.")\n msg = Message(domain=\'ui\', message="Total price doesn\'t match.")\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
\n \n
# if manual validation, check overdreaft facility\n
if state_change[\'transition\'].getId() == "wait_action":\n
context.checkAccountIsOverdraftFacility(state_change)\n
\n
\n
# Check each check operation line.\n # Check each check operation line.\n
for check_operation_line in transaction.contentValues(filter = {\'portal_type\' : \'Check Operation Line\'}):\n for check_operation_line in transaction.contentValues(filter = {\'portal_type\' : \'Check Operation Line\'}):\n
\n \n
...@@ -141,6 +146,7 @@ for check_operation_line in transaction.contentValues(filter = {\'portal_type\' ...@@ -141,6 +146,7 @@ for check_operation_line in transaction.contentValues(filter = {\'portal_type\'
\n \n
\n \n
# Test if the account balance is sufficient.\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 error = context.BankAccount_checkBalance(source_bank_account.getRelativeUrl(), check_operation_line.getPrice())\n
if error[\'error_code\'] == 1:\n if error[\'error_code\'] == 1:\n
msg = Message(domain=\'ui\', message="Bank account $account is not sufficient on line $line.",\n msg = Message(domain=\'ui\', message="Bank account $account is not sufficient on line $line.",\n
...@@ -159,7 +165,7 @@ for check_operation_line in transaction.contentValues(filter = {\'portal_type\' ...@@ -159,7 +165,7 @@ for check_operation_line in transaction.contentValues(filter = {\'portal_type\'
if check_operation_line.getAggregate() != check.getRelativeUrl():\n if check_operation_line.getAggregate() != check.getRelativeUrl():\n
check_operation_line.edit(aggregate=check.getRelativeUrl())\n check_operation_line.edit(aggregate=check.getRelativeUrl())\n
\n \n
if transaction.getSimulationState() == "draft":\n if transaction.getSimulationState() == "draft" and state_change[\'transition\'].getId() == "plan_action":\n
context.createCheckDepositLine(state_change)\n context.createCheckDepositLine(state_change)\n
...@@ -235,12 +241,12 @@ if transaction.getSimulationState() == "draft":\n ...@@ -235,12 +241,12 @@ if transaction.getSimulationState() == "draft":\n
<string>msg</string> <string>msg</string>
<string>price</string> <string>price</string>
<string>destination_bank_account</string> <string>destination_bank_account</string>
<string>context</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>check_operation_line</string> <string>check_operation_line</string>
<string>check_number</string> <string>check_number</string>
<string>check_type</string> <string>check_type</string>
<string>source_bank_account</string> <string>source_bank_account</string>
<string>context</string>
<string>error</string> <string>error</string>
<string>check</string> <string>check</string>
</tuple> </tuple>
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
</item> </item>
<item> <item>
<key> <string>script_name</string> </key> <key> <string>script_name</string> </key>
<value> <string>checkAccountIsOverdraftFacility</string> </value> <value> <string>validateConsistency</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
365 369
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment