diff --git a/product/ERP5/Tool/SimulationTool.py b/product/ERP5/Tool/SimulationTool.py
index fe10267f4e6a08fbdd1ea594006f37a3f4ab9f42..3aebe6dbb63f7b7f7587a856b78497501a994d1e 100755
--- a/product/ERP5/Tool/SimulationTool.py
+++ b/product/ERP5/Tool/SimulationTool.py
@@ -239,6 +239,16 @@ class SimulationTool (BaseTool):
       elif type(resource) is type([]) or type(resource) is type(()) :
         for resource_item in resource :
           resource_uid_list.append(self.portal_categories.restrictedTraverse(resource_item).getUid())
+      elif type(resource) is type({}) :
+        tmp_uid_list = []
+        if type(resource['query']) is type('') :
+          resource['query'] = [resource['query']]
+        for resource_item in resource['query'] :
+          tmp_uid_list.append(self.portal_categories.restrictedTraverse(resource_item).getUid())
+        if len(tmp_uid_list) :
+          resource_uid_list = {}
+          resource_uid_list['operator'] = resource['operator']
+          resource_uid_list['query'] = tmp_uid_list
       if len(resource_uid_list) :
         new_kw['stock.resource_uid'] = resource_uid_list
 
@@ -248,6 +258,16 @@ class SimulationTool (BaseTool):
       elif type(node) is type([]) or type(node) is type(()) :
         for node_item in node :
           node_uid_list.append(self.portal_categories.restrictedTraverse(node_item).getUid())
+      elif type(node) is type({}) :
+        tmp_uid_list = []
+        if type(node['query']) is type('') :
+          node['query'] = [node['query']]
+        for node_item in node['query'] :
+          tmp_uid_list.append(self.portal_categories.restrictedTraverse(node_item).getUid())
+        if len(tmp_uid_list) :
+          node_uid_list = {}
+          node_uid_list['operator'] = node['operator']
+          node_uid_list['query'] = tmp_uid_list
       if len(node_uid_list) :
         new_kw['stock.node_uid'] = node_uid_list
 
@@ -257,6 +277,16 @@ class SimulationTool (BaseTool):
       elif type(payment) is type([]) or type(payment) is type(()) :
         for payment_item in payment :
           payment_uid_list.append(self.portal_categories.restrictedTraverse(payment_item).getUid())
+      elif type(payment) is type({}) :
+        tmp_uid_list = []
+        if type(payment['query']) is type('') :
+          payment['query'] = [payment['query']]
+        for payment_item in payment['query'] :
+          tmp_uid_list.append(self.portal_categories.restrictedTraverse(payment_item).getUid())
+        if len(tmp_uid_list) :
+          payment_uid_list = {}
+          payment_uid_list['operator'] = payment['operator']
+          payment_uid_list['query'] = tmp_uid_list
       if len(payment_uid_list) :
         new_kw['stock.payment_uid'] = payment_uid_list
 
@@ -266,6 +296,16 @@ class SimulationTool (BaseTool):
       elif type(section) is type([]) or type(section) is type(()) :
         for section_item in section :
           section_uid_list.append(self.portal_categories.restrictedTraverse(section_item).getUid())
+      elif type(section) is type({}) :
+        tmp_uid_list = []
+        if type(section['query']) is type('') :
+          section['query'] = [section['query']]
+        for section_item in section['query'] :
+          tmp_uid_list.append(self.portal_categories.restrictedTraverse(section_item).getUid())
+        if len(tmp_uid_list) :
+          section_uid_list = {}
+          section_uid_list['operator'] = section['operator']
+          section_uid_list['query'] = tmp_uid_list
       if len(section_uid_list) :
         new_kw['stock.section_uid'] = section_uid_list
 
@@ -275,15 +315,35 @@ class SimulationTool (BaseTool):
       elif type(mirror_section) is type([]) or type(mirror_section) is type(()) :
         for mirror_section_item in mirror_section :
           mirror_section_uid_list.append(self.portal_categories.restrictedTraverse(mirror_section_item).getUid())
+      elif type(mirror_section) is type({}) :
+        tmp_uid_list = []
+        if type(mirror_section['query']) is type('') :
+          mirror_section['query'] = [mirror_section['query']]
+        for mirror_section_item in mirror_section['query'] :
+          tmp_uid_list.append(self.portal_categories.restrictedTraverse(mirror_section_item).getUid())
+        if len(tmp_uid_list) :
+          mirror_section_uid_list = {}
+          mirror_section_uid_list['operator'] = mirror_section['operator']
+          mirror_section_uid_list['query'] = tmp_uid_list
       if len(mirror_section_uid_list) :
         new_kw['stock.mirror_section_uid'] = mirror_section_uid_list
 
       variation_text_list = []
       if type(variation_text) is type('') :
-        variation_text_list.append(variation_text)
+        variation_text_list.append(variation_text) # Do not getUid for variation_text !
       elif type(variation_text) is type([]) or type(variation_text) is type(()) :
         for variation_text_item in variation_text :
           variation_text_list.append(variation_text_item)
+      elif type(variation_text) is type({}) :
+        tmp_uid_list = []
+        if type(variation_text['query']) is type('') :
+          variation_text['query'] = [variation_text['query']]
+        for variation_text_item in variation_text['query'] :
+          tmp_uid_list.append(variation_text_item)
+        if len(tmp_uid_list) :
+          variation_text_uid_list = {}
+          variation_text_uid_list['operator'] = variation_text['operator']
+          variation_text_uid_list['query'] = tmp_uid_list
       if len(variation_text_list) :
         new_kw['stock.variation_text'] = variation_text_list
 
@@ -293,6 +353,16 @@ class SimulationTool (BaseTool):
       elif type(resource_category) is type([]) or type(resource_category) is type(()) :
         for resource_category_item in resource_category :
           resource_category_uid_list.append(self.portal_categories.restrictedTraverse(resource_category_item).getUid())
+      elif type(resource_category) is type({}) :
+        tmp_uid_list = []
+        if type(resource_category['query']) is type('') :
+          resource_category['query'] = [resource_category['query']]
+        for resource_category_item in resource_category['query'] :
+          tmp_uid_list.append(self.portal_categories.restrictedTraverse(resource_category_item).getUid())
+        if len(tmp_uid_list) :
+          resource_category_uid_list = {}
+          resource_category_uid_list['operator'] = resource_category['operator']
+          resource_category_uid_list['query'] = tmp_uid_list
       if len(resource_category_uid_list) :
         new_kw['stock_resourceCategory'] = resource_category_uid_list
 
@@ -302,6 +372,16 @@ class SimulationTool (BaseTool):
       elif type(node_category) is type([]) or type(node_category) is type(()) :
         for node_category_item in node_category :
           node_category_uid_list.append(self.portal_categories.restrictedTraverse(node_category_item).getUid())
+      elif type(node_category) is type({}) :
+        tmp_uid_list = []
+        if type(node_category['query']) is type('') :
+          node_category['query'] = [node_category['query']]
+        for node_category_item in node_category['query'] :
+          tmp_uid_list.append(self.portal_categories.restrictedTraverse(node_category_item).getUid())
+        if len(tmp_uid_list) :
+          node_category_uid_list = {}
+          node_category_uid_list['operator'] = node_category['operator']
+          node_category_uid_list['query'] = tmp_uid_list
       if len(node_category_uid_list) :
         new_kw['stock_nodeCategory'] = node_category_uid_list
 
@@ -311,6 +391,16 @@ class SimulationTool (BaseTool):
       elif type(payment_category) is type([]) or type(payment_category) is type(()) :
         for payment_category_item in payment_category :
           payment_category_uid_list.append(self.portal_categories.restrictedTraverse(payment_category_item).getUid())
+      elif type(payment_category) is type({}) :
+        tmp_uid_list = []
+        if type(payment_category['query']) is type('') :
+          payment_category['query'] = [payment_category['query']]
+        for payment_category_item in payment_category['query'] :
+          tmp_uid_list.append(self.portal_categories.restrictedTraverse(payment_category_item).getUid())
+        if len(tmp_uid_list) :
+          payment_category_uid_list = {}
+          payment_category_uid_list['operator'] = payment_category['operator']
+          payment_category_uid_list['query'] = tmp_uid_list
       if len(payment_category_uid_list) :
         new_kw['stock_paymentCategory'] = payment_category_uid_list
 
@@ -320,6 +410,16 @@ class SimulationTool (BaseTool):
       elif type(section_category) is type([]) or type(section_category) is type(()) :
         for section_category_item in section_category :
           section_category_uid_list.append(self.portal_categories.restrictedTraverse(section_category_item).getUid())
+      elif type(section_category) is type({}) :
+        tmp_uid_list = []
+        if type(section_category['query']) is type('') :
+          section_category['query'] = [section_category['query']]
+        for section_category_item in section_category['query'] :
+          tmp_uid_list.append(self.portal_categories.restrictedTraverse(section_category_item).getUid())
+        if len(tmp_uid_list) :
+          section_category_uid_list = {}
+          section_category_uid_list['operator'] = section_category['operator']
+          section_category_uid_list['query'] = tmp_uid_list
       if len(section_category_uid_list) :
         new_kw['stock_sectionCategory'] = section_category_uid_list
 
@@ -329,6 +429,16 @@ class SimulationTool (BaseTool):
       elif type(mirror_section_category) is type([]) or type(mirror_section_category) is type(()) :
         for mirror_section_category_item in mirror_section_category :
           mirror_section_category_uid_list.append(self.portal_categories.restrictedTraverse(mirror_section_category_item).getUid())
+      elif type(mirror_section_category) is type({}) :
+        tmp_uid_list = []
+        if type(mirror_section_category['query']) is type('') :
+          mirror_section_category['query'] = [mirror_section_category['query']]
+        for mirror_section_category_item in mirror_section_category['query'] :
+          tmp_uid_list.append(self.portal_categories.restrictedTraverse(mirror_section_category_item).getUid())
+        if len(tmp_uid_list) :
+          mirror_section_category_uid_list = {}
+          mirror_section_category_uid_list['operator'] = mirror_section_category['operator']
+          mirror_section_category_uid_list['query'] = tmp_uid_list
       if len(mirror_section_category_uid_list) :
         new_kw['stock_mirrorSectionCategory'] = mirror_section_category_uid_list
 
@@ -338,6 +448,16 @@ class SimulationTool (BaseTool):
       elif type(variation_category) is type([]) or type(variation_category) is type(()) :
         for variation_category_item in variation_category :
           variation_category_uid_list.append(self.portal_categories.restrictedTraverse(variation_category_item).getUid())
+      elif type(variation_category) is type({}) :
+        tmp_uid_list = []
+        if type(variation_category['query']) is type('') :
+          variation_category['query'] = [variation_category['query']]
+        for variation_category_item in variation_category['query'] :
+          tmp_uid_list.append(self.portal_categories.restrictedTraverse(variation_category_item).getUid())
+        if len(tmp_uid_list) :
+          variation_category_uid_list = {}
+          variation_category_uid_list['operator'] = variation_category['operator']
+          variation_category_uid_list['query'] = tmp_uid_list
       if len(variation_category_uid_list) :
         new_kw['variationCategory'] = variation_category_uid_list