From a267d1c713236d78bed42b3d5f7543539ac96bd0 Mon Sep 17 00:00:00 2001 From: Simone Rubino Date: Tue, 23 Sep 2025 00:00:20 +0200 Subject: [PATCH] [FIX] account_payment_order: Manager can create partner bank accounts --- .../security/payment_security.xml | 9 ++++++ account_payment_order/tests/__init__.py | 1 + .../tests/test_partner_bank.py | 28 +++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 account_payment_order/tests/test_partner_bank.py diff --git a/account_payment_order/security/payment_security.xml b/account_payment_order/security/payment_security.xml index 71058572664..f488e3dc6ee 100644 --- a/account_payment_order/security/payment_security.xml +++ b/account_payment_order/security/payment_security.xml @@ -9,6 +9,15 @@ /> + + + + diff --git a/account_payment_order/tests/__init__.py b/account_payment_order/tests/__init__.py index c649cb8feae..e8b37db972f 100644 --- a/account_payment_order/tests/__init__.py +++ b/account_payment_order/tests/__init__.py @@ -1,5 +1,6 @@ from . import test_payment_mode from . import test_bank +from . import test_partner_bank from . import test_payment_order_inbound from . import test_payment_order_outbound from . import test_account_payment diff --git a/account_payment_order/tests/test_partner_bank.py b/account_payment_order/tests/test_partner_bank.py new file mode 100644 index 00000000000..7eda4f2718f --- /dev/null +++ b/account_payment_order/tests/test_partner_bank.py @@ -0,0 +1,28 @@ +# Copyright 2025 Simone Rubino +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.tests import Form, tagged + +from odoo.addons.account.tests.common import AccountTestInvoicingCommon + + +@tagged("post_install", "-at_install") +class TestPartnerBank(AccountTestInvoicingCommon): + def test_manager_create(self): + """An Account manager can create partner bank accounts.""" + # Arrange + user = self.env.user + partner_form = Form(self.env["res.partner"]) + partner_form.name = "Test Partner" + partner = partner_form.save() + # pre-condition + self.assertTrue(user.has_group("account.group_account_manager")) + + # Act + partner_bank_form = Form(self.env["res.partner.bank"]) + partner_bank_form.acc_number = "Test Account Number" + partner_bank_form.partner_id = partner + partner_bank = partner_bank_form.save() + + # Assert + self.assertTrue(partner_bank)