From 48db1b15aef57450689a07108df1300098f58586 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 2 Nov 2021 18:35:42 +0100 Subject: [PATCH] Update test suite Fix bug in account_banking_mandate when a res.partner.bank is not attached to a particular company (company_id is NOT required on res.partner.bank) --- .../tests/test_payment_mode.py | 37 ------------------- .../tests/test_payment_order_inbound.py | 2 +- .../tests/test_payment_order_outbound.py | 12 +++--- 3 files changed, 7 insertions(+), 44 deletions(-) diff --git a/account_payment_order/tests/test_payment_mode.py b/account_payment_order/tests/test_payment_mode.py index be60a17ac..0141fd510 100644 --- a/account_payment_order/tests/test_payment_mode.py +++ b/account_payment_order/tests/test_payment_mode.py @@ -1,7 +1,6 @@ # © 2017 Creu Blanca # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo.exceptions import ValidationError from odoo.tests.common import TransactionCase @@ -48,37 +47,6 @@ class TestPaymentMode(TransactionCase): } ) - def test_constrains(self): - with self.assertRaises(ValidationError): - self.payment_mode_c1.write( - {"generate_move": True, "offsetting_account": False} - ) - with self.assertRaises(ValidationError): - self.payment_mode_c1.write( - { - "generate_move": True, - "offsetting_account": "bank_account", - "move_option": False, - } - ) - with self.assertRaises(ValidationError): - self.payment_mode_c1.write( - { - "generate_move": True, - "offsetting_account": "transfer_account", - "transfer_account_id": False, - } - ) - with self.assertRaises(ValidationError): - self.payment_mode_c1.write( - { - "generate_move": True, - "offsetting_account": "transfer_account", - "transfer_account_id": self.account.id, - "transfer_journal_id": False, - } - ) - def test_onchange_generate_move(self): self.payment_mode_c1.generate_move = True self.payment_mode_c1.generate_move_change() @@ -87,11 +55,6 @@ class TestPaymentMode(TransactionCase): self.payment_mode_c1.generate_move_change() self.assertFalse(self.payment_mode_c1.move_option) - def test_onchange_offsetting_account(self): - self.payment_mode_c1.offsetting_account = "bank_account" - self.payment_mode_c1.offsetting_account_change() - self.assertFalse(self.payment_mode_c1.transfer_account_id) - def test_onchange_payment_type(self): self.payment_mode_c1.payment_method_id = self.manual_in self.payment_mode_c1.payment_method_id_change() diff --git a/account_payment_order/tests/test_payment_order_inbound.py b/account_payment_order/tests/test_payment_order_inbound.py index 2462bbf37..3b1195697 100644 --- a/account_payment_order/tests/test_payment_order_inbound.py +++ b/account_payment_order/tests/test_payment_order_inbound.py @@ -115,7 +115,7 @@ class TestPaymentOrderInbound(TestPaymentOrderInboundBase): with self.assertRaises(UserError): bank_line.unlink() - payment_order.action_done_cancel() + payment_order.action_uploaded_cancel() self.assertEqual(payment_order.state, "cancel") payment_order.cancel2draft() payment_order.unlink() diff --git a/account_payment_order/tests/test_payment_order_outbound.py b/account_payment_order/tests/test_payment_order_outbound.py index f1ccf5653..7ab83c26d 100644 --- a/account_payment_order/tests/test_payment_order_outbound.py +++ b/account_payment_order/tests/test_payment_order_outbound.py @@ -48,8 +48,8 @@ class TestPaymentOrderOutbound(AccountTestInvoicingCommon): ).id, } ) - cls.invoice = cls._create_supplier_invoice(cls) - cls.invoice_02 = cls._create_supplier_invoice(cls) + cls.invoice = cls._create_supplier_invoice(cls, "F1242") + cls.invoice_02 = cls._create_supplier_invoice(cls, "F1243") cls.bank_journal = cls.company_data["default_journal_bank"] # Make sure no other payment orders are in the DB cls.domain = [ @@ -59,11 +59,12 @@ class TestPaymentOrderOutbound(AccountTestInvoicingCommon): ] cls.env["account.payment.order"].search(cls.domain).unlink() - def _create_supplier_invoice(self): + def _create_supplier_invoice(self, ref): invoice = self.env["account.move"].create( { "partner_id": self.partner.id, "move_type": "in_invoice", + "ref": ref, "payment_mode_id": self.mode.id, "invoice_date": fields.Date.today(), "invoice_line_ids": [ @@ -157,8 +158,7 @@ class TestPaymentOrderOutbound(AccountTestInvoicingCommon): order.open2generated() order.generated2uploaded() self.assertEqual(order.move_ids[0].date, order.bank_line_ids[0].date) - order.action_done() - self.assertEqual(order.state, "done") + self.assertEqual(order.state, "uploaded") def test_cancel_payment_order(self): # Open invoice @@ -193,7 +193,7 @@ class TestPaymentOrderOutbound(AccountTestInvoicingCommon): with self.assertRaises(UserError): bank_line.unlink() - payment_order.action_done_cancel() + payment_order.action_uploaded_cancel() self.assertEqual(payment_order.state, "cancel") payment_order.cancel2draft() payment_order.unlink()