[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 9be9766535 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
This commit is contained in:
Vladimir Mitreski
2022-05-17 12:44:45 +02:00
committed by Atte Isopuro
parent a151fe56a4
commit 7c03b78437

View File

@@ -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",