diff --git a/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_deposit_workflow/scripts/validateConsistency.xml b/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_deposit_workflow/scripts/validateConsistency.xml index 83bac47a6268d77c24c6ccd484d8347d91dc4ba5..212967d7345b3133ad9488d2155148686f9e3c04 100644 --- a/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_deposit_workflow/scripts/validateConsistency.xml +++ b/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_deposit_workflow/scripts/validateConsistency.xml @@ -112,6 +112,7 @@ if state_change[\'transition\'].getId() == "wait_action":\n \n \n bank_account_dict = {}\n +seen_check_dict = {}\n \n # Check each check operation line.\n for check_operation_line in transaction.contentValues(filter = {\'portal_type\' : \'Check Operation Line\'}):\n @@ -139,6 +140,14 @@ for check_operation_line in transaction.contentValues(filter = {\'portal_type\' msg = Message(domain=\'ui\', message=\'Bank account not defined on line $line.\'\n , mapping={"line" : check_operation_line.getId()})\n raise ValidationFailed, (msg,)\n +\n + seen_check_dict_key = (source_bank_account, check_type, check_number)\n + seen_check = seen_check_dict.get(seen_check_dict_key)\n + if seen_check is not None:\n + msg = Message(domain=\'ui\', message=\'Check on line $line is already used on line $oldline.\'\n + , mapping={"line" : check_operation_line.getId(), "oldline": seen_check})\n + raise ValidationFailed, (msg,)\n + seen_check_dict[seen_check_dict_key] = check_operation_line.getId()\n \n # Test check is valid based on date\n transaction.Check_checkIntervalBetweenDate(resource=check_operation_line.getAggregateResourceValue(),\n @@ -245,14 +254,17 @@ if transaction.getSimulationState() == "draft" and state_change[\'transition\']. <string>destination_bank_account</string> <string>context</string> <string>bank_account_dict</string> + <string>seen_check_dict</string> <string>_getiter_</string> <string>check_operation_line</string> <string>check_number</string> <string>check_type</string> <string>source_bank_account</string> + <string>seen_check_dict_key</string> + <string>seen_check</string> + <string>_write_</string> <string>account_path</string> <string>check_price</string> - <string>_write_</string> <string>error</string> <string>check</string> </tuple> diff --git a/bt5/erp5_banking_check/bt/revision b/bt5/erp5_banking_check/bt/revision index e41567feb87fd40d6e88e91674e66a77a5074304..c4c828bd4ee315c1205df1586629eb43f5d672bd 100644 --- a/bt5/erp5_banking_check/bt/revision +++ b/bt5/erp5_banking_check/bt/revision @@ -1 +1 @@ -384 \ No newline at end of file +386 \ No newline at end of file