Skip to content

Commit

Permalink
Merge PR #1351 into 17.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Sep 20, 2024
2 parents 0ed68c3 + a499fb8 commit 4147854
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 23 deletions.
2 changes: 2 additions & 0 deletions account_banking_mandate/tests/test_invoice_mandate.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from odoo.tests.common import TransactionCase

from odoo.addons.account.models.account_payment_method import AccountPaymentMethod
from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT


class TestInvoiceMandate(TransactionCase):
Expand Down Expand Up @@ -203,6 +204,7 @@ def _create_res_bank(cls, name, bic, city, country):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))
cls.company = cls.env.ref("base.main_company")

cls.partner = cls._create_res_partner("Peter with ACME Bank")
Expand Down
7 changes: 5 additions & 2 deletions account_banking_mandate/tests/test_mandate.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
from odoo.exceptions import UserError, ValidationError
from odoo.tests.common import TransactionCase

from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT


class TestMandate(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.company = cls.env.company
cls.company_2 = cls.env["res.company"].create({"name": "company 2"})
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))
cls.company = cls.env.ref("base.main_company")
cls.company_2 = cls.env["res.company"].create({"name": "Company 2"})
cls.company_2.partner_id.company_id = cls.company_2.id
cls.bank_account = cls.env.ref("account_payment_mode.res_partner_12_iban")
cls.bank_account.partner_id.company_id = cls.company.id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,14 @@
from odoo import fields
from odoo.tests.common import Form, TransactionCase

from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT


class TestAccountPaymentOrder(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,
)
)
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))
cls.partner = cls.env["res.partner"].create({"name": "Test Partner"})
cls.product = cls.env["product.product"].create({"name": "Test product"})
cls.partner_bank_core = cls._create_res_partner_bank("N-CORE")
Expand Down
3 changes: 3 additions & 0 deletions account_banking_sepa_credit_transfer/tests/test_sct.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@
from odoo.exceptions import UserError
from odoo.tests.common import TransactionCase

from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT


class TestSCT(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))
cls.account_model = cls.env["account.account"]
cls.move_model = cls.env["account.move"]
cls.journal_model = cls.env["account.journal"]
Expand Down
21 changes: 16 additions & 5 deletions account_banking_sepa_direct_debit/tests/test_mandate.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,22 @@ def test_action_mandate_send(self):
self.assertEqual(self.mandate.state, "draft")
self.assertTrue(self.mandate.is_sent)

def setUp(self):
res = super().setUp()
self.partner = self.env.ref("base.res_partner_12")
bank_account = self.env.ref("account_payment_mode.res_partner_12_iban")
self.mandate = self.env["account.banking.mandate"].create(
@classmethod
def setUpClass(cls):
res = 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,
)
)
cls.partner = cls.env.ref("base.res_partner_12")
bank_account = cls.env.ref("account_payment_mode.res_partner_12_iban")
cls.mandate = cls.env["account.banking.mandate"].create(
{
"partner_bank_id": bank_account.id,
"format": "sepa",
Expand Down
3 changes: 3 additions & 0 deletions account_banking_sepa_direct_debit/tests/test_sdd.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@
from odoo.tests.common import TransactionCase
from odoo.tools import float_compare

from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT


class TestSDDBase(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))
cls.company_B = cls.env["res.company"].create({"name": "Company B"})
cls.account_payable_company_B = cls.env["account.account"].create(
{
Expand Down
4 changes: 3 additions & 1 deletion account_payment_mode/tests/test_account_payment_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
from odoo.exceptions import UserError, ValidationError
from odoo.tests.common import TransactionCase

from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT


class TestAccountPaymentMode(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))

cls.res_users_model = cls.env["res.users"]
cls.journal_model = cls.env["account.journal"]
Expand Down
7 changes: 7 additions & 0 deletions account_payment_order/tests/test_bank.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@
from odoo.exceptions import ValidationError
from odoo.tests.common import TransactionCase

from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT


class TestBank(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))

def test_bank(self):
bank = self.env["res.bank"].search([], limit=1)
self.assertTrue(bank)
Expand Down
4 changes: 2 additions & 2 deletions account_payment_order/tests/test_payment_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def setUpClass(cls):
AccountPaymentMethod._get_payment_method_information
)

def _get_payment_method_information(self):
res = Method_get_payment_method_information(self)
def _get_payment_method_information(cls):
res = Method_get_payment_method_information(cls)
res["IN"] = {"mode": "multi", "domain": [("type", "=", "bank")]}
res["IN2"] = {"mode": "multi", "domain": [("type", "=", "bank")]}
res["electronic_out"] = {"mode": "multi", "domain": [("type", "=", "bank")]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
from odoo.fields import Date
from odoo.tests.common import Form, TransactionCase

from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT


class TestAccountPaymentPartner(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))

cls.res_users_model = cls.env["res.users"]
cls.move_model = cls.env["account.move"]
Expand Down
5 changes: 3 additions & 2 deletions account_payment_sale/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@

from odoo.tests.common import TransactionCase

from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT


class CommonTestCase(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))

cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))
cls.bank = cls.env["res.partner.bank"].create(
{"acc_number": "test", "partner_id": cls.env.user.company_id.partner_id.id}
)
Expand Down
7 changes: 7 additions & 0 deletions account_payment_sale/tests/test_sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@

from odoo.tests import Form

from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT

from .common import CommonTestCase


class TestSaleOrder(CommonTestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))

def create_sale_order(self, payment_mode=None):
with Form(self.env["sale.order"]) as sale_form:
sale_form.partner_id = self.base_partner
Expand Down

0 comments on commit 4147854

Please sign in to comment.