Commit f01d49a1 authored by Jérome Perrin's avatar Jérome Perrin

give more priority to validated trade conditions and reject invalidated ones


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25243 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1539cf0b
......@@ -98,6 +98,8 @@ def rank_method(trade_condition):\n
if trade_condition.getDestination():\n
rank += 1\n
rank += len(trade_condition.getSpecialiseList())\n
if trade_condition.getValidationState() == \'validated\':\n
rank += 2\n
return rank\n
\n
def sort_method(a, b):\n
......
......@@ -53,7 +53,11 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>category_list = [\n
<value> <string>if context.getValidationState() == \'invalidated\':\n
# return a predicate that will never apply\n
return context.generatePredicate(criterion_property_list=(\'uid\',))\n
\n
category_list = [\n
\'source\', \'source_section\',\n
\'destination\', \'destination_section\',\n
]\n
......@@ -108,12 +112,12 @@ return date_context.generatePredicate(multimembership_criterion_base_category_li
<tuple>
<string>args</string>
<string>kw</string>
<string>_getattr_</string>
<string>context</string>
<string>category_list</string>
<string>criterion_list</string>
<string>_getiter_</string>
<string>category</string>
<string>_getattr_</string>
<string>context</string>
<string>date_context</string>
</tuple>
</value>
......
......@@ -98,6 +98,8 @@ def rank_method(trade_condition):\n
if trade_condition.getSource():\n
rank += 1\n
rank += len(trade_condition.getSpecialiseList())\n
if trade_condition.getValidationState() == \'validated\':\n
rank += 2\n
return rank\n
\n
def sort_method(a, b):\n
......
......@@ -53,7 +53,11 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>category_list = [\n
<value> <string>if context.getValidationState() == \'invalidated\':\n
# return a predicate that will never apply\n
return context.generatePredicate(criterion_property_list=(\'uid\',))\n
\n
category_list = [\n
\'source\', \'source_section\',\n
\'destination\', \'destination_section\',\n
]\n
......@@ -108,12 +112,12 @@ return date_context.generatePredicate(multimembership_criterion_base_category_li
<tuple>
<string>args</string>
<string>kw</string>
<string>_getattr_</string>
<string>context</string>
<string>category_list</string>
<string>criterion_list</string>
<string>_getiter_</string>
<string>category</string>
<string>_getattr_</string>
<string>context</string>
<string>date_context</string>
</tuple>
</value>
......
574
\ No newline at end of file
575
\ 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