[FIX] account: prevent crash in account.payment

when removing the bank in an account.payment, the method _get_available_payment_method_lines() was called on an empty recordset which wasn't supported.

Part-of: odoo/odoo#77122
This commit is contained in:
qdp-odoo
2021-09-24 15:49:57 +00:00
parent e3a0a62622
commit bb61168f7e
+2
View File
@@ -910,6 +910,8 @@ class AccountJournal(models.Model):
:param payment_type: either inbound or outbound, used to know which lines to return
:return: Either the inbound or outbound payment method lines
"""
if not self:
return self.env['account.payment.method.line']
self.ensure_one()
if payment_type == 'inbound':
return self.inbound_payment_method_line_ids