Commit 5de21504 authored by Sebastien Robin's avatar Sebastien Robin

we must have a description on each check deposit line

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16681 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent dcbb125f
...@@ -71,9 +71,6 @@ from Products.DCWorkflow.DCWorkflow import ValidationFailed\n ...@@ -71,9 +71,6 @@ from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from Products.ERP5Type.Message import Message\n from Products.ERP5Type.Message import Message\n
checkbook_reception = context.getParentValue()\n checkbook_reception = context.getParentValue()\n
\n \n
# Check getBaobabSource and getBaobabDestination\n
checkbook_reception.Base_checkBaobabSourceAndDestination()\n
\n
portal = checkbook_reception.getPortalObject()\n portal = checkbook_reception.getPortalObject()\n
portal_activities = portal.portal_activities\n portal_activities = portal.portal_activities\n
if encountered_check_identifiers_dict is None:\n if encountered_check_identifiers_dict is None:\n
...@@ -130,15 +127,16 @@ def generateTravelerCheckReference(number, original_traveler_check_reference):\n ...@@ -130,15 +127,16 @@ def generateTravelerCheckReference(number, original_traveler_check_reference):\n
prefix = getTravelerCheckReferencePrefix(original_traveler_check_reference)\n prefix = getTravelerCheckReferencePrefix(original_traveler_check_reference)\n
return \'%s%06d\' % (prefix, number)\n return \'%s%06d\' % (prefix, number)\n
\n \n
def assertReferenceMatchListEmpty(match_list):\n def assertReferenceMatchListEmpty(match_list, destination_payment_uid):\n
"""\n """\n
Check that the list is empty, otherwise gather all conflicting references and display them in the error message.\n Check that the list is empty, otherwise gather all conflicting references and display them in the error message.\n
TODO: make the error message Localizer-friendly\n TODO: make the error message Localizer-friendly\n
"""\n """\n
if len(match_list) > 0:\n if len(match_list) > 0:\n
account = context.portal_catalog(uid=destination_payment_uid)[0].getObject()\n
matched_reference_list = []\n matched_reference_list = []\n
for match in match_list:\n for match in match_list:\n
matched_reference_list.append(match.getReference())\n matched_reference_list.append(\'%s (%s)\' % (match.getReference(), account.getInternalBankAccountNumber()))\n
message = Message(domain=\'ui\', message=\'The following references are already allocated : $reference_list\',\n message = Message(domain=\'ui\', message=\'The following references are already allocated : $reference_list\',\n
mapping={\'reference_list\': matched_reference_list})\n mapping={\'reference_list\': matched_reference_list})\n
raise ValidationFailed, (message,)\n raise ValidationFailed, (message,)\n
...@@ -151,12 +149,13 @@ def checkReferenceListUniqueness(reference_list, model, destination_payment_uid) ...@@ -151,12 +149,13 @@ def checkReferenceListUniqueness(reference_list, model, destination_payment_uid)
match_list = portal.portal_catalog(portal_type=\'Check\', reference=reference_list, resource_relative_url=model)\n match_list = portal.portal_catalog(portal_type=\'Check\', reference=reference_list, resource_relative_url=model)\n
else:\n else:\n
match_list = portal.portal_catalog(portal_type=\'Check\', reference=reference_list, destination_payment_uid=destination_payment_uid, resource_relative_url=model)\n match_list = portal.portal_catalog(portal_type=\'Check\', reference=reference_list, destination_payment_uid=destination_payment_uid, resource_relative_url=model)\n
assertReferenceMatchListEmpty(match_list)\n assertReferenceMatchListEmpty(match_list, destination_payment_uid)\n
for reference in reference_list:\n for reference in reference_list:\n
tag = \'check_%s_%s_%s\' % (model, destination_payment_uid, reference)\n tag = \'check_%s_%s_%s\' % (model, destination_payment_uid, reference)\n
if encountered_check_identifiers_dict.has_key(tag):\n if encountered_check_identifiers_dict.has_key(tag):\n
account = context.portal_catalog(uid=destination_payment_uid)[0].getObject()\n
message = Message(domain=\'ui\', message=\'The following references are already allocated : $reference_list\',\n message = Message(domain=\'ui\', message=\'The following references are already allocated : $reference_list\',\n
mapping={\'reference_list\': [reference, ]})\n mapping={\'reference_list\': [\'%s (%s)\' % (reference, account.getInternalBankAccountNumber()) ]})\n
raise ValidationFailed, (message,)\n raise ValidationFailed, (message,)\n
encountered_check_identifiers_dict[tag] = None\n encountered_check_identifiers_dict[tag] = None\n
\n \n
......
...@@ -99,6 +99,12 @@ if transaction.getTotalPrice(portal_type = \'Check Operation Line\') != transact ...@@ -99,6 +99,12 @@ if transaction.getTotalPrice(portal_type = \'Check Operation Line\') != transact
\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
if check_operation_line.getDescription() in (None, \'\'):\n
msg = Message(domain=\'ui\', message=\'The description is not defined on line $line.\'\n
, mapping={"line" : check_operation_line.getId()})\n
raise ValidationFailed, (msg,)\n
\n
check_number = check_operation_line.getAggregateFreeText()\n check_number = check_operation_line.getAggregateFreeText()\n
if not check_number:\n if not check_number:\n
msg = Message(domain=\'ui\', message=\'Check is not defined on line $line.\'\n msg = Message(domain=\'ui\', message=\'Check is not defined on line $line.\'\n
......
327 328
\ 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