From 58bfeb6f3629abc502019bfd614647f2a60596f8 Mon Sep 17 00:00:00 2001 From: Hetashree Chauhan Date: Tue, 18 Jun 2019 09:29:53 +0000 Subject: [PATCH] [IMP] stock: pass tests without demo data for file test_move. pass all test cases without any demo data. If a user has not installed any demo data, then also test cases must not be break. task-2024202 closes : https://github.com/odoo/odoo/pull/34258 --- addons/stock/tests/test_move.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/addons/stock/tests/test_move.py b/addons/stock/tests/test_move.py index 76a156d14ba..db6cc6081e9 100644 --- a/addons/stock/tests/test_move.py +++ b/addons/stock/tests/test_move.py @@ -715,7 +715,7 @@ class StockMove(SavepointCase): }) # putaway from stock to shelf1 putaway = self.env['stock.putaway.rule'].create({ - 'product_id': self.env.ref('product.product_product_5').id, + 'product_id': self.product.id, 'location_in_id': self.stock_location.id, 'location_out_id': shelf1_location.id, }) @@ -728,7 +728,7 @@ class StockMove(SavepointCase): 'name': 'test_putaway_2', 'location_id': self.supplier_location.id, 'location_dest_id': self.stock_location.id, - 'product_id': self.env.ref('product.product_product_5').id, + 'product_id': self.product.id, 'product_uom': self.uom_unit.id, 'product_uom_qty': 100.0, }) @@ -766,7 +766,7 @@ class StockMove(SavepointCase): 'location_out_id': shelf1_location.id, }) putaway_product = self.env['stock.putaway.rule'].create({ - 'product_id': self.env.ref('stock.product_cable_management_box').id, + 'product_id': self.product.id, 'location_in_id': self.supplier_location.id, 'location_out_id': shelf2_location.id, }) @@ -782,8 +782,8 @@ class StockMove(SavepointCase): 'name': 'test_putaway_3', 'location_id': self.supplier_location.id, 'location_dest_id': self.stock_location.id, - 'product_id': self.env.ref('stock.product_cable_management_box').id, - 'product_uom': self.env.ref('uom.product_uom_kgm').id, + 'product_id': self.product.id, + 'product_uom': self.uom_unit.id, 'product_uom_qty': 100.0, }) move1._action_confirm() @@ -822,7 +822,7 @@ class StockMove(SavepointCase): 'location_out_id': shelf1_location.id, }) putaway_product = self.env['stock.putaway.rule'].create({ - 'product_id': self.env.ref('stock.product_cable_management_box').id, + 'product_id': self.product_consu.id, 'location_in_id': self.stock_location.id, 'location_out_id': shelf2_location.id, }) @@ -876,14 +876,13 @@ class StockMove(SavepointCase): putaway.id, ])], }) - # creation move1 = self.env['stock.move'].create({ 'name': 'test_putaway_5', 'location_id': self.supplier_location.id, 'location_dest_id': self.stock_location.id, - 'product_id': self.env.ref('stock.product_cable_management_box').id, - 'product_uom': self.env.ref('uom.product_uom_kgm').id, + 'product_id': self.product.id, + 'product_uom': self.uom_unit.id, 'product_uom_qty': 100.0, }) move1._action_confirm() @@ -920,7 +919,7 @@ class StockMove(SavepointCase): 'location_out_id': shelf1_location.id, }) putaway_category_office_furn = self.env['stock.putaway.rule'].create({ - 'category_id': self.env.ref('product.product_category_5').id, + 'category_id': self.ref('product.product_category_all'), 'location_in_id': self.supplier_location.id, 'location_out_id': shelf2_location.id, }) @@ -930,14 +929,15 @@ class StockMove(SavepointCase): putaway_category_office_furn.id, ])], }) + self.product.categ_id = self.ref('product.product_category_all') # creation move1 = self.env['stock.move'].create({ 'name': 'test_putaway_6', 'location_id': self.supplier_location.id, 'location_dest_id': self.stock_location.id, - 'product_id': self.env.ref('stock.product_cable_management_box').id, - 'product_uom': self.env.ref('uom.product_uom_kgm').id, + 'product_id': self.product.id, + 'product_uom': self.uom_unit.id, 'product_uom_qty': 100.0, }) move1._action_confirm()