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