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

Default group_by parameters for getMovementHistoryList should be handled in...

Default group_by parameters for getMovementHistoryList should be handled in the tool, not in the ZSQL Method.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17083 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5bf7feba
...@@ -832,6 +832,7 @@ class SimulationTool(BaseTool): ...@@ -832,6 +832,7 @@ class SimulationTool(BaseTool):
group_by_variation=0, group_by_sub_variation=0, group_by_variation=0, group_by_sub_variation=0,
group_by_movement=0, group_by_date=0, group_by_movement=0, group_by_date=0,
group_by_resource=None, group_by_resource=None,
movement_list_mode=0,
**ignored): **ignored):
""" """
Set defaults group_by parameters Set defaults group_by parameters
...@@ -840,7 +841,10 @@ class SimulationTool(BaseTool): ...@@ -840,7 +841,10 @@ class SimulationTool(BaseTool):
If any group-by is provided, automatically group by resource aswell If any group-by is provided, automatically group by resource aswell
unless group_by_resource is explicitely set to false. unless group_by_resource is explicitely set to false.
If no group by is provided, group by movement, node and resource. If no group by is provided, use the default group by: movement, node and
resource, unless movement_list_mode is true, in that case, group by
movement, node, resource and date (this is historically the default in
getMovementHistoryList).
""" """
new_group_by_dict = {} new_group_by_dict = {}
if not ignore_group_by: if not ignore_group_by:
...@@ -855,6 +859,8 @@ class SimulationTool(BaseTool): ...@@ -855,6 +859,8 @@ class SimulationTool(BaseTool):
new_group_by_dict['group_by_movement'] = 1 new_group_by_dict['group_by_movement'] = 1
new_group_by_dict['group_by_node'] = 1 new_group_by_dict['group_by_node'] = 1
new_group_by_dict['group_by_resource'] = 1 new_group_by_dict['group_by_resource'] = 1
if movement_list_mode:
new_group_by_dict['group_by_date'] = 1
return new_group_by_dict return new_group_by_dict
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
...@@ -1398,6 +1404,8 @@ class SimulationTool(BaseTool): ...@@ -1398,6 +1404,8 @@ class SimulationTool(BaseTool):
brains. The initial values can be passed, in case you want to have an brains. The initial values can be passed, in case you want to have an
"initial summary line". "initial summary line".
""" """
kw['movement_list_mode'] = 1
kw.update(self._getDefaultGroupByParameters(**kw))
sql_kw = self._generateSQLKeywordDict(**kw) sql_kw = self._generateSQLKeywordDict(**kw)
return self.Resource_zGetMovementHistoryList( return self.Resource_zGetMovementHistoryList(
src__=src__, ignore_variation=ignore_variation, src__=src__, ignore_variation=ignore_variation,
......
...@@ -762,12 +762,10 @@ WHERE\n ...@@ -762,12 +762,10 @@ WHERE\n
AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1)">\n AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1)">\n
</dtml-if>\n </dtml-if>\n
\n \n
<dtml-if group_by_expression>\n
GROUP BY\n GROUP BY\n
<dtml-if group_by_expression>\n
<dtml-var group_by_expression>\n <dtml-var group_by_expression>\n
<dtml-else>\n </dtml-if>\n
stock.uid, stock.node_uid, stock.resource_uid, stock.date\n
</dtml-if>\n
\n \n
<dtml-if order_by_expression>\n <dtml-if order_by_expression>\n
ORDER BY\n ORDER BY\n
...@@ -920,12 +918,10 @@ WHERE\n ...@@ -920,12 +918,10 @@ WHERE\n
AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1)">\n AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1)">\n
</dtml-if>\n </dtml-if>\n
\n \n
<dtml-if group_by_expression>\n
GROUP BY\n GROUP BY\n
<dtml-if group_by_expression>\n
<dtml-var group_by_expression>\n <dtml-var group_by_expression>\n
<dtml-else>\n </dtml-if>\n
stock.uid, stock.node_uid, stock.resource_uid, stock.date\n
</dtml-if>\n
\n \n
<dtml-if order_by_expression>\n <dtml-if order_by_expression>\n
ORDER BY\n ORDER BY\n
......
538 539
\ 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