diff --git a/account_payment_order/tests/test_account_payment.py b/account_payment_order/tests/test_account_payment.py index feee07439..d2ebefb58 100644 --- a/account_payment_order/tests/test_account_payment.py +++ b/account_payment_order/tests/test_account_payment.py @@ -14,6 +14,16 @@ class TestAccountPayment(AccountTestInvoicingCommon): @classmethod def setUpClass(cls, chart_template_ref=None): super().setUpClass(chart_template_ref=chart_template_ref) + cls.env = cls.env( + context=dict( + cls.env.context, + mail_create_nolog=True, + mail_create_nosubscribe=True, + mail_notrack=True, + no_reset_password=True, + tracking_disable=True, + ) + ) Method_get_payment_method_information = ( AccountPaymentMethod._get_payment_method_information diff --git a/account_payment_order/tests/test_bank.py b/account_payment_order/tests/test_bank.py index d5d78bf81..ab02b56c7 100644 --- a/account_payment_order/tests/test_bank.py +++ b/account_payment_order/tests/test_bank.py @@ -6,6 +6,20 @@ from odoo.tests.common import TransactionCase class TestBank(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env = cls.env( + context=dict( + cls.env.context, + mail_create_nolog=True, + mail_create_nosubscribe=True, + mail_notrack=True, + no_reset_password=True, + tracking_disable=True, + ) + ) + def test_bank(self): bank = self.env["res.bank"].search([], limit=1) self.assertTrue(bank) diff --git a/account_payment_order/tests/test_payment_mode.py b/account_payment_order/tests/test_payment_mode.py index 46a0a7d7b..335315d90 100644 --- a/account_payment_order/tests/test_payment_mode.py +++ b/account_payment_order/tests/test_payment_mode.py @@ -9,14 +9,23 @@ from odoo.addons.account.models.account_payment_method import AccountPaymentMeth class TestPaymentMode(TransactionCase): - def setUp(self): - super(TestPaymentMode, self).setUp() - + @classmethod + def setUpClass(cls): + super(TestPaymentMode, cls).setUpClass() + cls.env = cls.env( + context=dict( + cls.env.context, + mail_create_nolog=True, + mail_create_nosubscribe=True, + mail_notrack=True, + no_reset_password=True, + tracking_disable=True, + ) + ) Method_get_payment_method_information = ( AccountPaymentMethod._get_payment_method_information ) - @classmethod def _get_payment_method_information(cls): res = Method_get_payment_method_information(cls) res["IN"] = {"mode": "multi", "domain": [("type", "=", "bank")]} @@ -25,24 +34,24 @@ class TestPaymentMode(TransactionCase): return res # Company - self.company = self.env.ref("base.main_company") + cls.company = cls.env.ref("base.main_company") - self.journal_c1 = self.env["account.journal"].create( + cls.journal_c1 = cls.env["account.journal"].create( { "name": "Journal 1", "code": "J1", "type": "bank", - "company_id": self.company.id, + "company_id": cls.company.id, } ) - self.account = self.env["account.account"].search( - [("reconcile", "=", True), ("company_id", "=", self.company.id)], limit=1 + cls.account = cls.env["account.account"].search( + [("reconcile", "=", True), ("company_id", "=", cls.company.id)], limit=1 ) - self.manual_out = self.env.ref("account.account_payment_method_manual_out") + cls.manual_out = cls.env.ref("account.account_payment_method_manual_out") - self.manual_in = self.env.ref("account.account_payment_method_manual_in") + cls.manual_in = cls.env.ref("account.account_payment_method_manual_in") with patch.object( AccountPaymentMethod, @@ -50,7 +59,7 @@ class TestPaymentMode(TransactionCase): _get_payment_method_information, ): - self.electronic_out = self.env["account.payment.method"].create( + cls.electronic_out = cls.env["account.payment.method"].create( { "name": "Electronic Out", "code": "electronic_out", @@ -58,14 +67,14 @@ class TestPaymentMode(TransactionCase): } ) - self.payment_mode_c1 = self.env["account.payment.mode"].create( + cls.payment_mode_c1 = cls.env["account.payment.mode"].create( { "name": "Direct Debit of suppliers from Bank 1", "bank_account_link": "variable", - "payment_method_id": self.manual_out.id, - "company_id": self.company.id, - "fixed_journal_id": self.journal_c1.id, - "variable_journal_ids": [(6, 0, [self.journal_c1.id])], + "payment_method_id": cls.manual_out.id, + "company_id": cls.company.id, + "fixed_journal_id": cls.journal_c1.id, + "variable_journal_ids": [(6, 0, [cls.journal_c1.id])], } ) diff --git a/account_payment_order/tests/test_payment_order_inbound.py b/account_payment_order/tests/test_payment_order_inbound.py index 9624a9c3b..333474883 100644 --- a/account_payment_order/tests/test_payment_order_inbound.py +++ b/account_payment_order/tests/test_payment_order_inbound.py @@ -17,6 +17,16 @@ class TestPaymentOrderInboundBase(AccountTestInvoicingCommon): @classmethod def setUpClass(cls, chart_template_ref=None): super().setUpClass(chart_template_ref=chart_template_ref) + cls.env = cls.env( + context=dict( + cls.env.context, + mail_create_nolog=True, + mail_create_nosubscribe=True, + mail_notrack=True, + no_reset_password=True, + tracking_disable=True, + ) + ) cls.company = cls.company_data["company"] cls.env.user.company_id = cls.company.id cls.partner = cls.env["res.partner"].create( diff --git a/account_payment_order/tests/test_payment_order_outbound.py b/account_payment_order/tests/test_payment_order_outbound.py index 29feebab2..1bd77d303 100644 --- a/account_payment_order/tests/test_payment_order_outbound.py +++ b/account_payment_order/tests/test_payment_order_outbound.py @@ -17,6 +17,16 @@ class TestPaymentOrderOutboundBase(AccountTestInvoicingCommon): @classmethod def setUpClass(cls, chart_template_ref=None): super().setUpClass(chart_template_ref=chart_template_ref) + cls.env = cls.env( + context=dict( + cls.env.context, + mail_create_nolog=True, + mail_create_nosubscribe=True, + mail_notrack=True, + no_reset_password=True, + tracking_disable=True, + ) + ) cls.company = cls.company_data["company"] cls.env.user.company_id = cls.company.id cls.partner = cls.env["res.partner"].create(