From 72554d709adee3ce2071f96bf723c6ab669059ca Mon Sep 17 00:00:00 2001 From: David Ramia Date: Wed, 6 Jul 2022 14:02:42 +0200 Subject: [PATCH] [FIX] account_payment_order: Fix tests Some tests need to be run on post-install The bank_journal.inbound_payment_order_only field is true only if all inbound_payment_method_ids are payment_order_only True. For this we must include the "SEPA Direct Debit for customers" in test --- account_payment_order/__manifest__.py | 2 +- account_payment_order/tests/test_account_payment.py | 6 ++++++ account_payment_order/tests/test_payment_order_inbound.py | 3 +++ account_payment_order/tests/test_payment_order_outbound.py | 2 ++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/account_payment_order/__manifest__.py b/account_payment_order/__manifest__.py index 2be57eeb0..ffdc046c5 100644 --- a/account_payment_order/__manifest__.py +++ b/account_payment_order/__manifest__.py @@ -9,7 +9,7 @@ { "name": "Account Payment Order", - "version": "15.0.1.0.2", + "version": "15.0.1.0.3", "license": "AGPL-3", "author": "ACSONE SA/NV, " "Therp BV, " diff --git a/account_payment_order/tests/test_account_payment.py b/account_payment_order/tests/test_account_payment.py index e7853ffa4..edd838472 100644 --- a/account_payment_order/tests/test_account_payment.py +++ b/account_payment_order/tests/test_account_payment.py @@ -3,10 +3,13 @@ from unittest.mock import patch +from odoo.tests import tagged + from odoo.addons.account.models.account_payment_method import AccountPaymentMethod from odoo.addons.account.tests.common import AccountTestInvoicingCommon +@tagged("-at_install", "post_install") class TestAccountPayment(AccountTestInvoicingCommon): @classmethod def setUpClass(cls, chart_template_ref=None): @@ -62,6 +65,7 @@ class TestAccountPayment(AccountTestInvoicingCommon): ) # Journals cls.manual_in = cls.env.ref("account.account_payment_method_manual_in") + cls.sepa_in = cls.env.ref("account_banking_sepa_direct_debit.sepa_direct_debit") cls.manual_out = cls.env.ref("account.account_payment_method_manual_out") cls.bank_journal = cls.company_data["default_journal_bank"] @@ -78,6 +82,7 @@ class TestAccountPayment(AccountTestInvoicingCommon): self.assertTrue(self.inbound_payment_method_01.payment_order_only) self.assertTrue(self.inbound_payment_method_02.payment_order_only) self.manual_in.payment_order_only = True + self.sepa_in.payment_order_only = True self.assertTrue(self.bank_journal.inbound_payment_order_only) def test_account_payment_02(self): @@ -145,6 +150,7 @@ class TestAccountPayment(AccountTestInvoicingCommon): self.assertTrue(self.inbound_payment_method_01.payment_order_only) self.assertTrue(self.inbound_payment_method_02.payment_order_only) self.manual_in.payment_order_only = True + self.sepa_in.payment_order_only = True self.assertTrue(self.bank_journal.inbound_payment_order_only) # check journals journals = new_account_payment._get_default_journal() diff --git a/account_payment_order/tests/test_payment_order_inbound.py b/account_payment_order/tests/test_payment_order_inbound.py index 3b1195697..1e663f129 100644 --- a/account_payment_order/tests/test_payment_order_inbound.py +++ b/account_payment_order/tests/test_payment_order_inbound.py @@ -6,11 +6,13 @@ from datetime import date, timedelta from odoo.exceptions import UserError, ValidationError +from odoo.tests import tagged from odoo.tests.common import Form from odoo.addons.account.tests.common import AccountTestInvoicingCommon +@tagged("-at_install", "post_install") class TestPaymentOrderInboundBase(AccountTestInvoicingCommon): @classmethod def setUpClass(cls, chart_template_ref=None): @@ -77,6 +79,7 @@ class TestPaymentOrderInboundBase(AccountTestInvoicingCommon): return invoice_form.save() +@tagged("-at_install", "post_install") class TestPaymentOrderInbound(TestPaymentOrderInboundBase): def test_constrains_type(self): with self.assertRaises(ValidationError): diff --git a/account_payment_order/tests/test_payment_order_outbound.py b/account_payment_order/tests/test_payment_order_outbound.py index 8a087265a..ad867f249 100644 --- a/account_payment_order/tests/test_payment_order_outbound.py +++ b/account_payment_order/tests/test_payment_order_outbound.py @@ -6,10 +6,12 @@ from datetime import date, datetime, timedelta from odoo import fields from odoo.exceptions import UserError, ValidationError +from odoo.tests import tagged from odoo.addons.account.tests.common import AccountTestInvoicingCommon +@tagged("-at_install", "post_install") class TestPaymentOrderOutbound(AccountTestInvoicingCommon): @classmethod def setUpClass(cls, chart_template_ref=None):