Replace on_change_with_bank_account to on_change_payment_type to get bank_account invoice

From #049621
#162641
This commit is contained in:
Raimon Esteve 2023-10-09 15:59:55 +02:00
parent d7ed1332ae
commit 34ed68d65f

11
work.py
View file

@ -1,20 +1,21 @@
# This file is part of account_payment_type module for Tryton.
# The COPYRIGHT file at the top level of this repository contains
# the full copyright notices and license terms.
from trytond.pool import PoolMeta
__all__ = ['Work']
from trytond.pool import Pool, PoolMeta
class Work(metaclass=PoolMeta):
__name__ = 'project.work'
def _get_invoice(self):
Invoice = Pool().get('account.invoice')
invoice = super(Work, self)._get_invoice()
customer_payment_type = invoice.party.customer_payment_type
if customer_payment_type:
invoice.payment_type = customer_payment_type
if hasattr(invoice, 'on_change_with_bank_account'):
invoice.on_change_with_bank_account()
if hasattr(Invoice, 'bank_account') and invoice.payment_type:
invoice.on_change_payment_type()
return invoice