From ed53232d213c6a67efc0266c7def180d586dd841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Marques?= Date: Tue, 30 Mar 2021 11:25:33 +0100 Subject: [PATCH] [FIX] account_reconcile_payment_order: Fix tests Create journal instead of searching Change hardcoded value for amount of payment statements, after we cleared the taxes of the invoice lines in https://github.com/OCA/bank-payment/pull/798 TT28962 --- .../__manifest__.py | 2 +- .../test_account_reconcile_payment_order.py | 24 ++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/account_reconcile_payment_order/__manifest__.py b/account_reconcile_payment_order/__manifest__.py index 5ac2d647..274f3e63 100644 --- a/account_reconcile_payment_order/__manifest__.py +++ b/account_reconcile_payment_order/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Reconcile payment orders", - "version": "13.0.1.0.0", + "version": "13.0.1.0.1", "author": "Therp BV," "Tecnativa," "Odoo Community Association (OCA)", "license": "AGPL-3", "website": "https://github.com/OCA/account-reconcile", diff --git a/account_reconcile_payment_order/tests/test_account_reconcile_payment_order.py b/account_reconcile_payment_order/tests/test_account_reconcile_payment_order.py index a4a8e4bc..e335c3e7 100644 --- a/account_reconcile_payment_order/tests/test_account_reconcile_payment_order.py +++ b/account_reconcile_payment_order/tests/test_account_reconcile_payment_order.py @@ -12,14 +12,8 @@ class TestAccountReconcilePaymentOrder(TestPaymentOrderInboundBase): def setUpClass(cls): super().setUpClass() cls.widget_obj = cls.env["account.reconciliation.widget"] - cls.bank_journal = cls.env["account.journal"].search( - [ - ("type", "=", "bank"), - "|", - ("company_id", "=", cls.env.company.id), - ("company_id", "=", False), - ], - limit=1, + cls.bank_journal = cls.env["account.journal"].create( + {"name": "Test bank journal", "type": "bank"} ) # Create second invoice for being sure it handles the payment order cls.invoice2 = cls._create_customer_invoice(cls) @@ -32,7 +26,7 @@ class TestAccountReconcilePaymentOrder(TestPaymentOrderInboundBase): cls.invoice2.action_post() # Add to payment order using the wizard cls.env["account.invoice.payment.line.multi"].with_context( - active_model="account.move", active_ids=cls.invoice2.ids, + active_model="account.move", active_ids=cls.invoice2.ids ).create({}).run() # Prepare statement cls.statement = cls.env["account.bank.statement"].create( @@ -41,7 +35,15 @@ class TestAccountReconcilePaymentOrder(TestPaymentOrderInboundBase): "date": "2019-01-01", "journal_id": cls.bank_journal.id, "line_ids": [ - (0, 0, {"date": "2019-01-01", "name": "Test line", "amount": 230}), + ( + 0, + 0, + { + "date": "2019-01-01", + "name": "Test line", + "amount": 200, # 100 * 2 + }, + ), ], } ) @@ -56,7 +58,7 @@ class TestAccountReconcilePaymentOrder(TestPaymentOrderInboundBase): self.inbound_order.open2generated() self.inbound_order.generated2uploaded() # Check widget result - res = self.widget_obj.get_bank_statement_line_data(self.statement.line_ids.ids,) + res = self.widget_obj.get_bank_statement_line_data(self.statement.line_ids.ids) self.assertEqual(len(res["lines"][0]["reconciliation_proposition"]), 2) def test_reconcile_payment_order_transfer_account(self):