diff --git a/contract/tests/test_multicompany.py b/contract/tests/test_multicompany.py index 395d5d2e59..6d104b205a 100644 --- a/contract/tests/test_multicompany.py +++ b/contract/tests/test_multicompany.py @@ -8,14 +8,57 @@ class ContractMulticompanyCase(TestContractBase): @classmethod def setUpClass(cls): super().setUpClass() - chart_template = cls.env.ref("l10n_generic_coa.configurable_chart_template") cls.company_obj = cls.env["res.company"] cls.company_1 = cls.env.ref("base.main_company") vals = {"name": "Company 2"} cls.company_2 = cls.company_obj.create(vals) - chart_template.try_loading(company=cls.company_2) cls.env.user.company_ids |= cls.company_2 - + cls.env["account.journal"].create( + { + "name": "Journal purchase test 1", + "code": "JP1", + "type": "purchase", + "company_id": cls.company_2.id, + } + ) + account_payable_type = cls.env["account.account.type"].create( + { + "name": "Payable account type", + "type": "payable", + "internal_group": "liability", + } + ) + account_expense_type = cls.env["account.account.type"].create( + { + "name": "Expense account type", + "type": "other", + "internal_group": "expense", + } + ) + payable_account = cls.env["account.account"].create( + { + "name": "Payable Account", + "code": "PAY", + "user_type_id": account_payable_type.id, + "reconcile": True, + "company_id": cls.company_2.id, + } + ) + expense_account = cls.env["account.account"].create( + { + "name": "Expense Account", + "code": "EXP", + "user_type_id": account_expense_type.id, + "reconcile": False, + "company_id": cls.company_2.id, + } + ) + cls.partner.with_company( + cls.company_2 + ).property_account_payable_id = payable_account.id + cls.product_1.with_company( + cls.company_2 + ).property_account_expense_id = expense_account.id cls.contract_mc = ( cls.env["contract.contract"] .with_company(cls.company_2)