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

check the life time of items

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16901 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 95bdc58c
......@@ -125,20 +125,26 @@ for check_operation_line in transaction.contentValues(filter = {\'portal_type\'
raise ValidationFailed, (msg,)\n
\n
# Test check is valid based on date\n
if \'compte\' in check_operation_line.getAggregateResourceTitle():\n
interval = getIntervalBetweenDates(check_operation_line.getStartDate(), check_operation_line.getStopDate())\n
if interval[\'year\'] >= 3:\n
if interval[\'month\'] > 0 or interval["day"] > 0:\n
msg = Message(domain=\'ui\', message="Check $check is more than 3 years old.",\n
mapping={"check" : check_operation_line.getAggregateFreeText()})\n
raise ValidationFailed, (msg,)\n
elif \'virement\' in check_operation_line.getAggregateResourceTitle():\n
interval = getIntervalBetweenDates(check_operation_line.getStartDate(), check_operation_line.getStopDate())\n
if interval[\'month\'] >= 3:\n
if interval["day"] > 0:\n
msg = Message(domain=\'ui\', message="Check $check is more than 3 month old.",\n
mapping={"check" : check_operation_line.getAggregateFreeText()})\n
raise ValidationFailed, (msg,)\n
transaction.Check_checkIntervalBetweenDate(resource=check_operation_line.getAggregateResourceValue(),\n
start_date=check_operation_line.getStartDate(),\n
stop_date=check_operation_line.getStopDate(),\n
check_nb=check_operation_line.getAggregateFreeText())\n
\n
# \n
# if \'compte\' in check_operation_line.getAggregateResourceTitle():\n
# interval = getIntervalBetweenDates(check_operation_line.getStartDate(), check_operation_line.getStopDate())\n
# if interval[\'year\'] >= 3:\n
# if interval[\'month\'] > 0 or interval["day"] > 0:\n
# msg = Message(domain=\'ui\', message="Check $check is more than 3 years old.",\n
# mapping={"check" : check_operation_line.getAggregateFreeText()})\n
# raise ValidationFailed, (msg,)\n
# elif \'virement\' in check_operation_line.getAggregateResourceTitle():\n
# interval = getIntervalBetweenDates(check_operation_line.getStartDate(), check_operation_line.getStopDate())\n
# if interval[\'month\'] >= 3:\n
# if interval["day"] > 0:\n
# msg = Message(domain=\'ui\', message="Check $check is more than 3 month old.",\n
# mapping={"check" : check_operation_line.getAggregateFreeText()})\n
# raise ValidationFailed, (msg,)\n
\n
\n
# Test if the account balance is sufficient.\n
......@@ -241,7 +247,6 @@ if transaction.getSimulationState() == "draft":\n
<string>check_number</string>
<string>check_type</string>
<string>source_bank_account</string>
<string>interval</string>
<string>context</string>
<string>error</string>
<string>check</string>
......
......@@ -62,6 +62,7 @@
<string>View</string>
<string>Access contents information</string>
<string>Modify portal content</string>
<string>Delete objects</string>
</tuple>
</value>
</item>
......
......@@ -73,6 +73,9 @@ from Products.ERP5Type.Message import Message\n
transaction = state_change[\'object\']\n
\n
date = transaction.getStartDate()\n
from DateTime import DateTime\n
now = DateTime()\n
\n
source = transaction.getSource(None)\n
if source is None:\n
msg = Message(domain=\'ui\', message=\'No counter defined.\')\n
......@@ -96,7 +99,7 @@ if ref_min is not None or ref_max is not None:\n
resource=aggregate_resource)\n
if len(check_list)>0:\n
# First make sure there is no delivery line\n
line_list = transaction.objectValues(portal_type=\'Cash Delivery Line\')\n
line_list = transaction.objectValues(portal_type=\'Checkbook Delivery Line\')\n
if len(line_list)>0:\n
id_list = [x.getId() for x in line_list]\n
transaction.manage_delObjects(ids=id_list)\n
......@@ -134,6 +137,13 @@ for movement in movement_list:\n
if item.getSimulationState()!=\'confirmed\':\n
msg = Message(domain = "ui", message="Sorry, this check is not issued")\n
raise ValidationFailed, (msg,)\n
# Test check is valid based on date\n
transaction.Check_checkIntervalBetweenDate(resource=item.getResourceValue(),\n
start_date=date,\n
stop_date=now,\n
check_nb=item.getTitle())\n
\n
\n
debit_required = transaction.isDebitRequired()\n
if total_debit in (None,0.0) and debit_required:\n
msg = Message(domain = "ui", message="Sorry, you forgot to give the amount")\n
......@@ -236,6 +246,8 @@ if debit_required:\n
<string>transaction</string>
<string>_getattr_</string>
<string>date</string>
<string>DateTime</string>
<string>now</string>
<string>None</string>
<string>source</string>
<string>msg</string>
......
......@@ -54,17 +54,14 @@
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Persistence</string>
<string>PersistentMapping</string>
</tuple>
<none/>
<global name="PersistentMapping" module="Persistence.mapping"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_container</string> </key>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
......@@ -77,6 +74,12 @@
</tuple>
</value>
</item>
<item>
<key> <string>Delete objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>Modify portal content</string> </key>
<value>
......
......@@ -73,6 +73,12 @@
</tuple>
</value>
</item>
<item>
<key> <string>Delete objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>Modify portal content</string> </key>
<value>
......
......@@ -80,6 +80,16 @@
</tuple>
</value>
</item>
<item>
<key> <string>Delete objects</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>Modify portal content</string> </key>
<value>
......
......@@ -76,6 +76,14 @@
</tuple>
</value>
</item>
<item>
<key> <string>Delete objects</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>Modify portal content</string> </key>
<value>
......
......@@ -76,6 +76,12 @@
</tuple>
</value>
</item>
<item>
<key> <string>Delete objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>Modify portal content</string> </key>
<value>
......
328
\ No newline at end of file
329
\ 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