mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[14.0][IMP] contract: Improve multi-company tests / don't break former tests structure
This commit is contained in:
@@ -17,7 +17,7 @@ def to_date(date):
|
|||||||
return fields.Date.to_date(date)
|
return fields.Date.to_date(date)
|
||||||
|
|
||||||
|
|
||||||
class TestContractBase:
|
class TestContractBase(common.SavepointCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
super().setUpClass()
|
super().setUpClass()
|
||||||
@@ -169,7 +169,7 @@ class TestContractBase:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class TestContract(TestContractBase, common.SavepointCase):
|
class TestContract(TestContractBase):
|
||||||
def _add_template_line(self, overrides=None):
|
def _add_template_line(self, overrides=None):
|
||||||
if overrides is None:
|
if overrides is None:
|
||||||
overrides = {}
|
overrides = {}
|
||||||
|
|||||||
@@ -1,18 +1,19 @@
|
|||||||
# Copyright 2021 ACSONE SA/NV (<http://acsone.eu>)
|
# Copyright 2021 ACSONE SA/NV (<http://acsone.eu>)
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
|
|
||||||
|
|
||||||
from .test_contract import TestContractBase
|
from .test_contract import TestContractBase
|
||||||
|
|
||||||
|
|
||||||
class ContractMulticompanyCase(TestContractBase, AccountTestInvoicingCommon):
|
class ContractMulticompanyCase(TestContractBase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
super().setUpClass()
|
super().setUpClass()
|
||||||
|
chart_template = cls.env.ref("l10n_generic_coa.configurable_chart_template")
|
||||||
cls.company_obj = cls.env["res.company"]
|
cls.company_obj = cls.env["res.company"]
|
||||||
cls.company_1 = cls.env.ref("base.main_company")
|
cls.company_1 = cls.env.ref("base.main_company")
|
||||||
cls.company_2 = cls.company_data_2["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.user.company_ids |= cls.company_2
|
||||||
|
|
||||||
cls.contract_mc = (
|
cls.contract_mc = (
|
||||||
|
|||||||
Reference in New Issue
Block a user