Commit 959834de authored by Nicolas Delaby's avatar Nicolas Delaby

Use future tracking list as fallback only if explicit argument is passed.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45594 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 61e0ee17
...@@ -52,6 +52,8 @@ ...@@ -52,6 +52,8 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>"""Helper script used by many scripts Item_get*(Value|Title) used for UI\n <value> <string>"""Helper script used by many scripts Item_get*(Value|Title) used for UI\n
It helps to improve consistency between all those scripts\n It helps to improve consistency between all those scripts\n
\n
fallback_on_future: if True return future Tracking List if current Tracking List is empty\n
"""\n """\n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
\n \n
...@@ -65,7 +67,7 @@ sql_kw = {\'item\': context.getRelativeUrl(),\n ...@@ -65,7 +67,7 @@ sql_kw = {\'item\': context.getRelativeUrl(),\n
\n \n
affectation_list = portal.portal_simulation.getCurrentTrackingList(**sql_kw)\n affectation_list = portal.portal_simulation.getCurrentTrackingList(**sql_kw)\n
\n \n
if not affectation_list:\n if fallback_on_future and not affectation_list:\n
if default_at_date:\n if default_at_date:\n
del sql_kw[\'at_date\']\n del sql_kw[\'at_date\']\n
affectation_list = portal.portal_simulation.getFutureTrackingList(**sql_kw)\n affectation_list = portal.portal_simulation.getFutureTrackingList(**sql_kw)\n
...@@ -75,7 +77,7 @@ return affectation_list\n ...@@ -75,7 +77,7 @@ return affectation_list\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>at_date=None, **kw</string> </value> <value> <string>at_date=None, fallback_on_future=False, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>current_site = context.Item_getCurrentOriginValue(at_date=at_date)\n <value> <string>current_site = context.Item_getCurrentOriginValue(**kw)\n
if current_site is not None:\n if current_site is not None:\n
return current_site.getSourceTitle()\n return current_site.getSourceTitle()\n
return None\n return None\n
...@@ -58,7 +58,7 @@ return None\n ...@@ -58,7 +58,7 @@ return None\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>at_date=None</string> </value> <value> <string>**kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -56,7 +56,7 @@ last_affectation_list = context.Item_getAffectationList(**kw)\n ...@@ -56,7 +56,7 @@ last_affectation_list = context.Item_getAffectationList(**kw)\n
if not last_affectation_list:\n if not last_affectation_list:\n
return None\n return None\n
\n \n
if last_affectation_list[-1].node_uid is not None:\n if last_affectation_list[-1].delivery_uid is not None:\n
site = portal.portal_catalog.getObject(last_affectation_list[-1].delivery_uid)\n site = portal.portal_catalog.getObject(last_affectation_list[-1].delivery_uid)\n
return site\n return site\n
</string> </value> </string> </value>
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>resource = context.Item_getResourceValue(at_date=at_date)\n <value> <string>resource = context.Item_getResourceValue(**kw)\n
if resource is not None:\n if resource is not None:\n
return resource.getTitle()\n return resource.getTitle()\n
return None\n return None\n
...@@ -58,7 +58,7 @@ return None\n ...@@ -58,7 +58,7 @@ return None\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>at_date=None</string> </value> <value> <string>**kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
288 289
\ 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