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

give priority to trade conditions where both source and destintion section are from the same group

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41336 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bf6db856
......@@ -78,8 +78,10 @@ else:\n
\n
def rank_method(trade_condition):\n
rank = 0\n
destination_section_group = None\n
destination_section = trade_condition.getDestinationSection()\n
if destination_section:\n
destination_section_group = trade_condition.getDestinationSectionValue().getGroup()\n
if destination_section == context.getDestinationSection():\n
rank += 10\n
else:\n
......@@ -92,6 +94,13 @@ def rank_method(trade_condition):\n
rank -= 2\n
if trade_condition.getSourceSection():\n
rank += 1\n
if destination_section_group:\n
source_section_group = trade_condition.getSourceSectionValue().getGroup()\n
if source_section_group:\n
if source_section_group.startswith(destination_section_group) \\\n
or destination_section_group.startswith(source_section_group):\n
# trade conditions where both sections are in the same group must have high priority\n
rank += 20\n
if trade_condition.getSource():\n
rank += 1\n
rank += len(trade_condition.getSpecialiseList())\n
......
1080
\ No newline at end of file
1081
\ 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