Commit 545cf733 authored by Sebastien Robin's avatar Sebastien Robin

added parameters: group_by_sub_variation, sub_variation_text


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4807 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2a606a3c
...@@ -188,7 +188,8 @@ class SimulationTool (BaseTool): ...@@ -188,7 +188,8 @@ class SimulationTool (BaseTool):
section_category=None, mirror_section_category=None, section_category=None, mirror_section_category=None,
simulation_state=None, transit_simulation_state = None, omit_transit=0, simulation_state=None, transit_simulation_state = None, omit_transit=0,
input_simulation_state = None, output_simulation_state=None, input_simulation_state = None, output_simulation_state=None,
variation_text=None, variation_category=None, variation_text=None, sub_variation_text=None,
variation_category=None,
**kw) : **kw) :
""" """
generates keywork and calls buildSqlQuery generates keywork and calls buildSqlQuery
...@@ -240,6 +241,10 @@ class SimulationTool (BaseTool): ...@@ -240,6 +241,10 @@ class SimulationTool (BaseTool):
if len(variation_text_list) : if len(variation_text_list) :
new_kw[table + '.variation_text'] = variation_text_list new_kw[table + '.variation_text'] = variation_text_list
sub_variation_text_list = self._generatePropertyUidList(sub_variation_text, as_text=1)
if len(sub_variation_text_list) :
new_kw[table + '.sub_variation_text'] = sub_variation_text_list
resource_category_uid_list = self._generatePropertyUidList(resource_category) resource_category_uid_list = self._generatePropertyUidList(resource_category)
if len(resource_category_uid_list) : if len(resource_category_uid_list) :
new_kw[table + '_resourceCategory'] = resource_category_uid_list new_kw[table + '_resourceCategory'] = resource_category_uid_list
...@@ -323,6 +328,8 @@ class SimulationTool (BaseTool): ...@@ -323,6 +328,8 @@ class SimulationTool (BaseTool):
group_by_expression_list = [] group_by_expression_list = []
if kw.get('group_by_node',0): if kw.get('group_by_node',0):
group_by_expression_list.append('stock.node_uid') group_by_expression_list.append('stock.node_uid')
if kw.get('group_by_sub_variation',0):
group_by_expression_list.append('stock.sub_variation_text')
if kw.get('group_by_variation',0): if kw.get('group_by_variation',0):
group_by_expression_list.append('stock.variation_text') group_by_expression_list.append('stock.variation_text')
if len(group_by_expression_list): if len(group_by_expression_list):
...@@ -372,6 +379,8 @@ class SimulationTool (BaseTool): ...@@ -372,6 +379,8 @@ class SimulationTool (BaseTool):
this needs to be extended with some kind of variation_category ? this needs to be extended with some kind of variation_category ?
XXX this way of implementing variation selection is far from perfect XXX this way of implementing variation selection is far from perfect
sub_variation_text - only take rows in stock table with specified variation_text
variation_category - variation or list of possible variations (it is not a cross-search ; SQL query uses OR) variation_category - variation or list of possible variations (it is not a cross-search ; SQL query uses OR)
simulation_state - only take rows with specified simulation_state simulation_state - only take rows with specified simulation_state
...@@ -401,6 +410,8 @@ class SimulationTool (BaseTool): ...@@ -401,6 +410,8 @@ class SimulationTool (BaseTool):
group_by_node (useless on getInventory, but useful on getInventoryList) group_by_node (useless on getInventory, but useful on getInventoryList)
group_by_sub_variation (useless on getInventory, but useful on getInventoryList)
**kw - if we want extended selection with more keywords (but bad performance) **kw - if we want extended selection with more keywords (but bad performance)
check what we can do with buildSqlQuery check what we can do with buildSqlQuery
......
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