diff --git a/product/ERP5/Tool/SimulationTool.py b/product/ERP5/Tool/SimulationTool.py index 7a0ae614487a9d02b27769a7a2b660e5bc77c6c7..3135f4e992421851112a64491980d49ce5106fa9 100644 --- a/product/ERP5/Tool/SimulationTool.py +++ b/product/ERP5/Tool/SimulationTool.py @@ -268,6 +268,7 @@ class SimulationTool (BaseTool): 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 @@ class SimulationTool (BaseTool): 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 @@ class SimulationTool (BaseTool): 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 @@ class SimulationTool (BaseTool): 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( diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventory.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventory.xml index b79ccbe9e6d8718deb614236f6809bbfdd04a9a3..0d9388ed3c65aeb9a25540cb275942af973dae25 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventory.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventory.xml @@ -101,6 +101,12 @@ </dictionary> </value> </item> + <item> + <key> <string>section_filtered</string> </key> + <value> + <dictionary/> + </value> + </item> <item> <key> <string>selection_domain</string> </key> <value> @@ -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 @@ standardize\r\n 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 @@ SELECT\n \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 @@ SELECT\n \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 diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventoryList.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventoryList.xml index d9c7f13843754159800f932370df1f436243103c..b9897a27b59847542233e296c39bcfe1c31ca2cc 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventoryList.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventoryList.xml @@ -109,6 +109,12 @@ </dictionary> </value> </item> + <item> + <key> <string>section_filtered</string> </key> + <value> + <dictionary/> + </value> + </item> <item> <key> <string>selection_domain</string> </key> <value> @@ -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 @@ selection_report\r\n 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 @@ SELECT\n \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 @@ SELECT\n \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 diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetMovementHistoryList.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetMovementHistoryList.xml index 55951cb501193b95f90b97f31f2f85c6c64b8a10..2e5eb12fc9b6f6f02f79559bd41501074f59db6a 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetMovementHistoryList.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetMovementHistoryList.xml @@ -113,6 +113,12 @@ </dictionary> </value> </item> + <item> + <key> <string>section_filtered</string> </key> + <value> + <dictionary/> + </value> + </item> <item> <key> <string>selection_domain</string> </key> <value> @@ -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 @@ standardize\r\n 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 @@ output_simulation_state:list</string> </value> 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 @@ SELECT\n \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 @@ ORDER BY\n 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 @@ SELECT\n \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 diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision index eebd1d10b6ec9917baf4df7f2e3de79e031a9af7..b2412e34dff05e77952f3f930772631cac5a3be7 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/revision +++ b/product/ERP5/bootstrap/erp5_core/bt/revision @@ -1 +1 @@ -61 \ No newline at end of file +62 \ No newline at end of file diff --git a/product/ERP5/tests/testInventoryAPI.py b/product/ERP5/tests/testInventoryAPI.py index 54b6438e4c1595379c069adaac77aa4e510c953a..461c0d2d5d50d6ebfd9ff69d378e6b59be4adda7 100644 --- a/product/ERP5/tests/testInventoryAPI.py +++ b/product/ERP5/tests/testInventoryAPI.py @@ -491,12 +491,13 @@ class TestMovementHistoryList(InventoryAPITestCase): """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.