From 15fdcb1821d38151aabfa0c4fd545a853993bcbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Thu, 23 May 2024 16:45:28 +0200 Subject: [PATCH] [IMP] account_move_template: Company compatibility in tests We need to obtain records from the company in question to avoid errors if there is data created in different companies. --- .../test_account_move_template_options.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/account_move_template/tests/test_account_move_template_options.py b/account_move_template/tests/test_account_move_template_options.py index bc152f18f..9d8ea3c50 100644 --- a/account_move_template/tests/test_account_move_template_options.py +++ b/account_move_template/tests/test_account_move_template_options.py @@ -14,18 +14,30 @@ class TestAccountMoveTemplateEnhanced(TransactionCase): cls.Account = cls.env["account.account"] cls.Template = cls.env["account.move.template"] cls.Partner = cls.env["res.partner"] + cls.company = cls.env.company - cls.journal = cls.Journal.search([("type", "=", "general")], limit=1) + cls.journal = cls.Journal.search( + [("type", "=", "general"), ("company_id", "=", cls.company.id)], limit=1 + ) cls.ar_account_id = cls.Account.search( - [("account_type", "=", "asset_receivable")], limit=1 + [ + ("account_type", "=", "asset_receivable"), + ("company_id", "=", cls.company.id), + ], + limit=1, ) cls.ap_account_id = cls.Account.search( - [("account_type", "=", "liability_payable")], limit=1 + [ + ("account_type", "=", "liability_payable"), + ("company_id", "=", cls.company.id), + ], + limit=1, ) cls.income_account_id = cls.Account.search( [ ("account_type", "=", "income_other"), ("internal_group", "=", "income"), + ("company_id", "=", cls.company.id), ], limit=1, ) @@ -33,6 +45,7 @@ class TestAccountMoveTemplateEnhanced(TransactionCase): [ ("account_type", "=", "expense"), ("internal_group", "=", "expense"), + ("company_id", "=", cls.company.id), ], limit=1, )