Commit f56991c4 authored by Aurel's avatar Aurel

use isItemType in check

remove isMovement to use providesIMovement
change checks order for optimization

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30973 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 25b7cdd1
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
non_reflected_portal_type = []\n non_reflected_portal_type = []\n
item_type_list = context.getPortalItemTypeList()\n
item_container_type_list = []\n item_container_type_list = []\n
\n \n
log = 0\n log = 0\n
...@@ -67,7 +66,7 @@ if log:\n ...@@ -67,7 +66,7 @@ if log:\n
\n \n
# items and their container go in all catalog\n # items and their container go in all catalog\n
ptype = context.getPortalType()\n ptype = context.getPortalType()\n
if ptype in item_type_list:\n if context.isItemType():\n
return True\n return True\n
if ptype in item_container_type_list:\n if ptype in item_container_type_list:\n
return True\n return True\n
...@@ -82,6 +81,18 @@ if getattr(context, \'getExplanationValue\', None) is not None:\n ...@@ -82,6 +81,18 @@ if getattr(context, \'getExplanationValue\', None) is not None:\n
in item_container_type_list:\n in item_container_type_list:\n
return True\n return True\n
\n \n
# Except those we don\'t want\n
if ptype not in non_reflected_portal_type:\n
# Object not delivery or movement goes in all archive\n
if not(context.providesIMovement() or context.isDelivery()):\n
if log:\n
context.log(" - document is not Movement/Delivery", "")\n
return True\n
else:\n
result = result and True\n
if log:\n
context.log(" - result after reflected", "%s" %result)\n
\n
# Check Date\n # Check Date\n
if getattr(context, \'getStopDate\', None) is not None:\n if getattr(context, \'getStopDate\', None) is not None:\n
max_stop_date = predicate.getStopDateRangeMax()\n max_stop_date = predicate.getStopDateRangeMax()\n
...@@ -95,16 +106,6 @@ if getattr(context, \'getStopDate\', None) is not None:\n ...@@ -95,16 +106,6 @@ if getattr(context, \'getStopDate\', None) is not None:\n
if log:\n if log:\n
context.log("result after date", result)\n context.log("result after date", result)\n
\n \n
# Except those we don\'t want\n
if ptype not in non_reflected_portal_type:\n
# Object not delivery or movement goes in all archive\n
result = result or (not(getattr(context, \'isMovement\', 0) or getattr(context, \'isDelivery\', 0)))\n
if log:\n
context.log(" - result after isMovement/Delivery", "%s" %result)\n
else:\n
result = result and True\n
if log:\n
context.log(" - result after reflected", "%s" %result)\n
\n \n
# XXX must manage specific case like Applied Rule, where do we want them to go ?\n # XXX must manage specific case like Applied Rule, where do we want them to go ?\n
return result\n return result\n
...@@ -148,13 +149,12 @@ return result\n ...@@ -148,13 +149,12 @@ return result\n
<tuple> <tuple>
<string>predicate</string> <string>predicate</string>
<string>non_reflected_portal_type</string> <string>non_reflected_portal_type</string>
<string>_getattr_</string>
<string>context</string>
<string>item_type_list</string>
<string>item_container_type_list</string> <string>item_container_type_list</string>
<string>log</string> <string>log</string>
<string>True</string> <string>True</string>
<string>result</string> <string>result</string>
<string>_getattr_</string>
<string>context</string>
<string>ptype</string> <string>ptype</string>
<string>getattr</string> <string>getattr</string>
<string>None</string> <string>None</string>
......
79 80
\ 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