From fc1e71d3252465037ba686ae4b2e76edd4c8e66d Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Tue, 28 Jun 2005 12:04:59 +0000
Subject: [PATCH] added group by expression

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3361 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Tool/SimulationTool.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/product/ERP5/Tool/SimulationTool.py b/product/ERP5/Tool/SimulationTool.py
index 899811a4eb..29edb645ba 100755
--- a/product/ERP5/Tool/SimulationTool.py
+++ b/product/ERP5/Tool/SimulationTool.py
@@ -272,6 +272,16 @@ class SimulationTool (BaseTool):
 
       sql_kw.update(self.portal_catalog.buildSQLQuery(**new_kw))
 
+      # build the group by expression
+      group_by_expression_list = []
+      if kw.get('group_by_node',0):
+        group_by_expression_list.append('stock.node_uid')
+      if kw.get('group_by_variation',0):
+        group_by_expression_list.append('stock.variation_text')
+      if len(group_by_expression_list):
+        group_by_expression_list.append('stock.resource_uid') # Always group by resource
+        sql_kw['group_by_expression'] = ', '.join(group_by_expression_list)
+
       return sql_kw
 
     #######################################################
@@ -335,6 +345,10 @@ class SimulationTool (BaseTool):
 
       selection_domain, selection_report - see ListBox
 
+      group_by_variation
+
+      group_by_node
+
       **kw  - if we want extended selection with more keywords (but bad performance)
               check what we can do with buildSqlQuery
       """
-- 
2.30.9