From 8b3812eb382f9c9428ee7cf172d24873287d793d Mon Sep 17 00:00:00 2001 From: William Henrotin Date: Tue, 19 Mar 2024 10:26:56 +0100 Subject: [PATCH] [FIX] stock_account: reinforce search domain in test The account move search was not enough specific to retreive only one account move. The following `assert` sometimes failed because of this. This commit reinforce to search to get only one account move closes odoo/odoo#158327 Opw: runbot error 60338 X-original-commit: 78518f5dbf26680f678c6bbd950d60bb96eeedfe Signed-off-by: Arnold Moyaux (arm) Signed-off-by: William Henrotin (whe) --- addons/stock_account/tests/test_stockvaluation.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/stock_account/tests/test_stockvaluation.py b/addons/stock_account/tests/test_stockvaluation.py index 27fefc06df0..869047aabaa 100644 --- a/addons/stock_account/tests/test_stockvaluation.py +++ b/addons/stock_account/tests/test_stockvaluation.py @@ -4064,6 +4064,9 @@ class TestStockValuation(TestStockValuationBase): revaluation = revaluation_form.save() revaluation.action_validate_revaluation() - account_move = self.env['account.move'].search([('journal_id', '=', revaluation.account_journal_id.id)]) + account_move = self.env['stock.valuation.layer'].search([ + ('product_id', '=', self.product1.id), + ('stock_move_id', '=', False), + ]).account_move_id self.assertEqual(account_move.line_ids[0].name, 'OdooBot changed stock valuation from 15.0 to 25.0 - [prda] Product A')