From 79d1529c571848c70a42e3b3d28a761f79dd6505 Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Fri, 9 Feb 2018 14:41:50 +0100 Subject: [PATCH] [FIX] stock: tests and inactive locations `child_of` used to return inactive records, it doesn't anymore --- addons/stock/tests/common.py | 8 ++++++-- addons/stock/tests/test_move.py | 1 + addons/stock/tests/test_quant.py | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/addons/stock/tests/common.py b/addons/stock/tests/common.py index ea8434c7f6e..31a7f78df1d 100644 --- a/addons/stock/tests/common.py +++ b/addons/stock/tests/common.py @@ -27,8 +27,12 @@ class TestStockCommon(common.TransactionCase): self.picking_type_out = self.ModelDataObj.xmlid_to_res_id('stock.picking_type_out') self.supplier_location = self.ModelDataObj.xmlid_to_res_id('stock.stock_location_suppliers') self.stock_location = self.ModelDataObj.xmlid_to_res_id('stock.stock_location_stock') - self.pack_location = self.ModelDataObj.xmlid_to_res_id('stock.location_pack_zone') - self.output_location = self.ModelDataObj.xmlid_to_res_id('stock.stock_location_output') + pack_location = self.env.ref('stock.location_pack_zone') + pack_location.active = True + self.pack_location = pack_location.id + output_location = self.env.ref('stock.stock_location_output') + output_location.active = True + self.output_location = output_location.id self.customer_location = self.ModelDataObj.xmlid_to_res_id('stock.stock_location_customers') self.categ_unit = self.ModelDataObj.xmlid_to_res_id('uom.product_uom_categ_unit') self.categ_kgm = self.ModelDataObj.xmlid_to_res_id('uom.product_uom_categ_kgm') diff --git a/addons/stock/tests/test_move.py b/addons/stock/tests/test_move.py index 3e20a6ee588..8e7eba5e5f7 100644 --- a/addons/stock/tests/test_move.py +++ b/addons/stock/tests/test_move.py @@ -12,6 +12,7 @@ class StockMove(TransactionCase): self.customer_location = self.env.ref('stock.stock_location_customers') self.supplier_location = self.env.ref('stock.stock_location_suppliers') self.pack_location = self.env.ref('stock.location_pack_zone') + self.pack_location.active = True self.transit_location = self.env['stock.location'].search([ ('company_id', '=', self.env.user.company_id.id), ('usage', '=', 'transit'), diff --git a/addons/stock/tests/test_quant.py b/addons/stock/tests/test_quant.py index 9a8dc37ee51..baebfc1de9d 100644 --- a/addons/stock/tests/test_quant.py +++ b/addons/stock/tests/test_quant.py @@ -525,6 +525,7 @@ class StockQuant(TransactionCase): def test_action_done_1(self): stock_location = self.env.ref('stock.stock_location_stock') pack_location = self.env.ref('stock.location_pack_zone') + pack_location.active = True product1 = self.env['product.product'].create({ 'name': 'Product A', 'type': 'product',