[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) <sle@openerp.com>
This commit is contained in:
Simon Lejeune
2020-02-06 20:50:58 +00:00
parent 93b2377656
commit e2b42f3718
@@ -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]