mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[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
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user