From e2b42f371819c15e86a184bcda9ab5f500cacdcb Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Tue, 4 Feb 2020 13:20:31 +0000 Subject: [PATCH] [FIX] stock_landed_costs: flaky tests We chose the vendors by searching random res.partner but sometimes partners of another company are returned, making the _check_company mechanism raise an error. closes odoo/odoo#44815 X-original-commit: 1cfcf21efa888720f9c34b337532251db6fd0089 Signed-off-by: Simon Lejeune (sle) --- .../stock_landed_costs/tests/test_stockvaluationlayer.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/stock_landed_costs/tests/test_stockvaluationlayer.py b/addons/stock_landed_costs/tests/test_stockvaluationlayer.py index 640ca6b3488..99ea441db26 100644 --- a/addons/stock_landed_costs/tests/test_stockvaluationlayer.py +++ b/addons/stock_landed_costs/tests/test_stockvaluationlayer.py @@ -238,9 +238,9 @@ class TestStockValuationLCFIFOVB(TestStockValuationLCCommon): @classmethod def setUpClass(cls): super(TestStockValuationLCFIFOVB, cls).setUpClass() - cls.vendor1 = cls.env['res.partner'].search([], limit=1) + cls.vendor1 = cls.env['res.partner'].create({'name': 'vendor1'}) cls.vendor1.property_account_payable_id = cls.payable_account - cls.vendor2 = cls.env['res.partner'].search([], limit=2)[-1] + cls.vendor2 = cls.env['res.partner'].create({'name': 'vendor2'}) cls.vendor2.property_account_payable_id = cls.payable_account cls.product1.product_tmpl_id.categ_id.property_cost_method = 'fifo' cls.product1.product_tmpl_id.categ_id.property_valuation = 'real_time' @@ -355,7 +355,8 @@ class TestStockValuationLCFIFOVB(TestStockValuationLCCommon): # Process the receipt receipt = rfq.picking_ids wiz = receipt.button_validate() - wiz = self.env['stock.immediate.transfer'].browse(wiz['res_id']).process() + wiz = Form(self.env['stock.immediate.transfer'].with_context(wiz['context'])).save() + wiz.process() self.assertEqual(rfq.order_line.qty_received, 10) input_aml = self._get_stock_input_move_lines()[-1]