From 7c03b7843751bf7d785ec65b2ea4346e2fe5dbe9 Mon Sep 17 00:00:00 2001 From: Vladimir Mitreski Date: Tue, 17 May 2022 12:44:45 +0200 Subject: [PATCH] [FIX] account_payment_purchase: Make payment method to require bank account Without this fix, the partner_bank_id was being reset to False on change of 'company_id' in the _onchange_purchase_auto_complete method in account.move in the following unit test: def test_from_purchase_order_invoicing_bank That's because in commit 9be9766535e46b53f30de1aa143d92d49bd97acd we switched to getting payment method from env.ref('account.account_payment_method_manual_out'), which has bank_account_required == False by default, while before that we were creating payment method for which we were explicitly setting bank_account_required as True Also tag unit test as post_install --- .../tests/test_account_payment_purchase.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/account_payment_purchase/tests/test_account_payment_purchase.py b/account_payment_purchase/tests/test_account_payment_purchase.py index 67b65d4ed..07dd5bc43 100644 --- a/account_payment_purchase/tests/test_account_payment_purchase.py +++ b/account_payment_purchase/tests/test_account_payment_purchase.py @@ -3,9 +3,10 @@ # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from odoo import fields -from odoo.tests import Form, TransactionCase +from odoo.tests import Form, TransactionCase, tagged +@tagged("-at_install", "post_install") class TestAccountPaymentPurchase(TransactionCase): @classmethod def setUpClass(cls): @@ -16,6 +17,7 @@ class TestAccountPaymentPurchase(TransactionCase): cls.payment_method_out = cls.env.ref( "account.account_payment_method_manual_out" ) + cls.payment_method_out.bank_account_required = True cls.payment_mode = cls.env["account.payment.mode"].create( { "name": "Test payment mode",