[Erp5-report] r9797 - in /erp5/trunk/products/ERP5: Tool/ bootstrap/erp5_core/SkinTemplateI...

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Sep 11 11:25:50 CEST 2006


Author: jerome
Date: Mon Sep 11 11:25:47 2006
New Revision: 9797

URL: http://svn.erp5.org?rev=9797&view=rev
Log:
avoid left join on section if a section is already filtered.
fix error in testInventoryAPI


Modified:
    erp5/trunk/products/ERP5/Tool/SimulationTool.py
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventory.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventoryList.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetMovementHistoryList.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision
    erp5/trunk/products/ERP5/tests/testInventoryAPI.py

Modified: erp5/trunk/products/ERP5/Tool/SimulationTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/SimulationTool.py?rev=9797&r1=9796&r2=9797&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/SimulationTool.py (original)
+++ erp5/trunk/products/ERP5/Tool/SimulationTool.py Mon Sep 11 11:25:47 2006
@@ -268,6 +268,7 @@
         new_kw[table + '.resource_uid'] = resource_uid
       if section_uid is not None :
         new_kw[table + '.section_uid'] = section_uid
+        sql_kw['section_filtered'] = 1
       if node_uid is not None :
         new_kw[table + '.node_uid'] = node_uid
 
@@ -290,6 +291,7 @@
       section_uid_list = self._generatePropertyUidList(section)
       if section_uid_list:
         new_kw[table + '.section_uid'] = section_uid_list
+        sql_kw['section_filtered'] = 1
 
       mirror_section_uid_list = self._generatePropertyUidList(mirror_section)
       if mirror_section_uid_list:
@@ -322,6 +324,7 @@
       section_category_uid_list = self._generatePropertyUidList(section_category)
       if section_category_uid_list:
         new_kw[table + '_section_category_uid'] = section_category_uid_list
+        sql_kw['section_filtered'] = 1
 
       mirror_section_category_uid_list = self._generatePropertyUidList(
                                               mirror_section_category)
@@ -353,6 +356,7 @@
       if section_category_strict_membership_uid_list:
         new_kw[table + '_section_category_strict_membership_uid'] =\
             section_category_strict_membership_uid_list
+        sql_kw['section_filtered'] = 1
 
       mirror_section_category_strict_membership_uid_list =\
             self._generatePropertyUidList(

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventory.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventory.xml?rev=9797&r1=9796&r2=9797&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventory.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventory.xml Mon Sep 11 11:25:47 2006
@@ -102,6 +102,12 @@
                                 </value>
                             </item>
                             <item>
+                                <key> <string>section_filtered</string> </key>
+                                <value>
+                                  <dictionary/>
+                                </value>
+                            </item>
+                            <item>
                                 <key> <string>selection_domain</string> </key>
                                 <value>
                                   <dictionary/>
@@ -142,6 +148,7 @@
 <string>omit_simulation</string>
 <string>omit_input</string>
 <string>omit_output</string>
+<string>section_filtered</string>
 <string>input_simulation_state</string>
 <string>output_simulation_state</string>
 <string>group_by_expression</string>
@@ -177,6 +184,7 @@
 omit_simulation\r\n
 omit_input\r\n
 omit_output\r\n
+section_filtered\r\n
 input_simulation_state:list\r\n
 output_simulation_state:list\r\n
 group_by_expression</string> </value>
@@ -236,7 +244,8 @@
 \n
 FROM\n
   stock\n
-  LEFT JOIN catalog AS section ON (section.uid = stock.section_uid)\n
+  <dtml-if section_filtered> INNER <dtml-else> LEFT </dtml-if>\n
+      JOIN catalog AS section ON (section.uid = stock.section_uid)\n
 <dtml-in prefix="table" expr="from_table_list"> \n
   <dtml-if expr="table_key != \'stock\'">\n
   , <dtml-var table_item> AS <dtml-var table_key>\n
@@ -366,7 +375,8 @@
 \n
 FROM\n
   stock\n
-  LEFT JOIN catalog AS section ON (section.uid = stock.section_uid)\n
+  <dtml-if section_filtered> INNER <dtml-else> LEFT </dtml-if>\n
+      JOIN catalog AS section ON (section.uid = stock.section_uid)\n
 <dtml-in prefix="table" expr="from_table_list"> \n
   <dtml-if expr="table_key != \'stock\'">\n
   , <dtml-var table_item> AS <dtml-var table_key>\n

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventoryList.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventoryList.xml?rev=9797&r1=9796&r2=9797&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventoryList.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventoryList.xml Mon Sep 11 11:25:47 2006
@@ -107,6 +107,12 @@
                                         <value> <string>list</string> </value>
                                     </item>
                                   </dictionary>
+                                </value>
+                            </item>
+                            <item>
+                                <key> <string>section_filtered</string> </key>
+                                <value>
+                                  <dictionary/>
                                 </value>
                             </item>
                             <item>
@@ -149,6 +155,7 @@
 <string>ignore_variation</string>
 <string>standardize</string>
 <string>omit_simulation</string>
+<string>section_filtered</string>
 <string>omit_input</string>
 <string>omit_output</string>
 <string>input_simulation_state</string>
@@ -184,6 +191,7 @@
 ignore_variation\r\n
 standardize\r\n
 omit_simulation\r\n
+section_filtered\r\n
 omit_input\r\n
 omit_output\r\n
 input_simulation_state:list\r\n
@@ -247,7 +255,8 @@
 \n
 FROM\n
   stock\n
-  LEFT JOIN catalog AS section ON (section.uid = stock.section_uid)\n
+  <dtml-if section_filtered> INNER <dtml-else> LEFT </dtml-if>  \n
+       JOIN catalog AS section ON (section.uid = stock.section_uid)\n
 <dtml-in prefix="table" expr="from_table_list"> \n
   <dtml-if expr="table_key != \'stock\'">\n
   , <dtml-var table_item> AS <dtml-var table_key>\n
@@ -384,7 +393,8 @@
 \n
 FROM\n
   stock\n
-  LEFT JOIN catalog AS section ON (section.uid = stock.section_uid)\n
+  <dtml-if section_filtered> INNER <dtml-else> LEFT </dtml-if>  \n
+       JOIN catalog AS section ON (section.uid = stock.section_uid)\n
 <dtml-in prefix="table" expr="from_table_list"> \n
   <dtml-if expr="table_key != \'stock\'">\n
   , <dtml-var table_item> AS <dtml-var table_key>\n

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetMovementHistoryList.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetMovementHistoryList.xml?rev=9797&r1=9796&r2=9797&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetMovementHistoryList.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetMovementHistoryList.xml Mon Sep 11 11:25:47 2006
@@ -111,6 +111,12 @@
                                         <value> <string>list</string> </value>
                                     </item>
                                   </dictionary>
+                                </value>
+                            </item>
+                            <item>
+                                <key> <string>section_filtered</string> </key>
+                                <value>
+                                  <dictionary/>
                                 </value>
                             </item>
                             <item>
@@ -155,6 +161,7 @@
 <string>omit_simulation</string>
 <string>omit_input</string>
 <string>omit_output</string>
+<string>section_filtered</string>
 <string>initial_running_total_quantity</string>
 <string>initial_running_total_price</string>
 <string>input_simulation_state</string>
@@ -601,6 +608,7 @@
 omit_simulation\r\n
 omit_input\r\n
 omit_output\r\n
+section_filtered\r\n
 initial_running_total_quantity\r\n
 initial_running_total_price\r\n
 input_simulation_state:list\r\n
@@ -646,7 +654,6 @@
 
 SET @running_total_quantity := <dtml-var initial_running_total_quantity>,\n
     @running_total_price := <dtml-var initial_running_total_price>;\n
-\n
 <dtml-var sql_delimiter>\n
 \n
 SELECT \n
@@ -676,7 +683,8 @@
 \n
 FROM\n
   stock\n
-  LEFT JOIN catalog AS section ON (section.uid = stock.section_uid)\n
+  <dtml-if section_filtered> INNER <dtml-else> LEFT </dtml-if>  \n
+        JOIN catalog AS section ON (section.uid = stock.section_uid)\n
 <dtml-in prefix="table" expr="from_table_list"> \n
   <dtml-if expr="table_key != \'stock\'">\n
   , <dtml-var table_item> AS <dtml-var table_key>\n
@@ -798,7 +806,6 @@
 
 SET @running_total_quantity := <dtml-var initial_running_total_quantity>,\n
     @running_total_price := <dtml-var initial_running_total_price>;\n
-\n
 <dtml-var sql_delimiter>\n
 \n
 SELECT \n
@@ -828,7 +835,8 @@
 \n
 FROM\n
   stock\n
-  LEFT JOIN catalog AS section ON (section.uid = stock.section_uid)\n
+  <dtml-if section_filtered> INNER <dtml-else> LEFT </dtml-if>  \n
+        JOIN catalog AS section ON (section.uid = stock.section_uid)\n
 <dtml-in prefix="table" expr="from_table_list"> \n
   <dtml-if expr="table_key != \'stock\'">\n
   , <dtml-var table_item> AS <dtml-var table_key>\n

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision?rev=9797&r1=9796&r2=9797&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision Mon Sep 11 11:25:47 2006
@@ -1,1 +1,1 @@
-61
+62

Modified: erp5/trunk/products/ERP5/tests/testInventoryAPI.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testInventoryAPI.py?rev=9797&r1=9796&r2=9797&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testInventoryAPI.py (original)
+++ erp5/trunk/products/ERP5/tests/testInventoryAPI.py Mon Sep 11 11:25:47 2006
@@ -491,12 +491,13 @@
     """Movement History List returns a sequence object""" 
     getMovementHistoryList = self.getSimulationTool().getMovementHistoryList
     mvt_history_list = getMovementHistoryList()
-    self.failUnless(str(mvt_history_list.__class__),
+    self.assertEquals(str(mvt_history_list.__class__),
                     'Shared.DC.ZRDB.Results.Results')
     # default is an empty list
     self.assertEquals(0, len(mvt_history_list))
   
   def testMovementBothSides(self):
+    """Movement History List returns movement from both sides""" 
     getMovementHistoryList = self.getSimulationTool().getMovementHistoryList
     self._makeMovement(quantity=100)
     # we don't filter, so we have the same movement from both sides.




More information about the Erp5-report mailing list