diff --git a/stock_available_mrp/tests/test_potential_qty.py b/stock_available_mrp/tests/test_potential_qty.py index a1321eb58..a98d8cfe6 100644 --- a/stock_available_mrp/tests/test_potential_qty.py +++ b/stock_available_mrp/tests/test_potential_qty.py @@ -74,27 +74,33 @@ class TestPotentialQty(TransactionCase): "The potential without a BoM should be 0") def test_potential_qty_no_bom_for_company(self): - # Receive 1000x CPUa8s + chicago_id = self.ref('stock.res_company_1') + + # Receive 1000x CPUa8s owned by Chicago inventory = self.env['stock.inventory'].create( {'name': 'Receive CPUa8', + 'company_id': chicago_id, 'location_id': self.wh_ch.lot_stock_id.id, - 'filter': 'none'}) + 'filter': 'partial'}) inventory.prepare_inventory() self.env['stock.inventory.line'].create({ 'inventory_id': inventory.id, + 'company_id': chicago_id, 'product_id': self.ref('product.product_product_23'), 'location_id': self.wh_ch.lot_stock_id.id, 'product_qty': 1000.0}) inventory.action_done() - # Receive enough RAM-SR3 to make 1000x the 1st variant in main WH + # Put RAM-SR3 owned by Chicago for 1000x the 1st variant in main WH inventory = self.env['stock.inventory'].create( {'name': 'components for 1st variant', + 'company_id': chicago_id, 'location_id': self.wh_ch.lot_stock_id.id, - 'filter': 'none'}) + 'filter': 'partial'}) inventory.prepare_inventory() self.env['stock.inventory.line'].create({ 'inventory_id': inventory.id, + 'company_id': chicago_id, 'product_id': self.ref('product.product_product_15'), 'location_id': self.wh_ch.lot_stock_id.id, 'product_qty': 1000.0}) @@ -123,10 +129,8 @@ class TestPotentialQty(TransactionCase): # and the demo user on Chicago (child of main company) self.env['product.product'].search([ TRUE_LEAF]).write({'company_id': False}) - chicago_id = self.ref('stock.res_company_1') test_user.write({'company_id': chicago_id, 'company_ids': [(4, chicago_id)]}) - test_user = test_user.sudo(test_user) bom.company_id = self.ref('base.main_company') self.assertPotentialQty( test_user_tmpl, 0, @@ -146,7 +150,7 @@ class TestPotentialQty(TransactionCase): inventory = self.env['stock.inventory'].create( {'name': 'Receive CPUa8', 'location_id': self.wh_main.lot_stock_id.id, - 'filter': 'none'}) + 'filter': 'partial'}) inventory.prepare_inventory() self.env['stock.inventory.line'].create({ 'inventory_id': inventory.id, @@ -164,7 +168,7 @@ class TestPotentialQty(TransactionCase): inventory = self.env['stock.inventory'].create( {'name': 'components for 1st variant', 'location_id': self.wh_main.lot_stock_id.id, - 'filter': 'none'}) + 'filter': 'partial'}) inventory.prepare_inventory() self.env['stock.inventory.line'].create({ 'inventory_id': inventory.id, @@ -187,7 +191,7 @@ class TestPotentialQty(TransactionCase): inventory = self.env['stock.inventory'].create( {'name': 'components for 2nd variant', 'location_id': self.wh_ch.lot_stock_id.id, - 'filter': 'none'}) + 'filter': 'partial'}) inventory.prepare_inventory() self.env['stock.inventory.line'].create({ 'inventory_id': inventory.id,