From 59b2e181d84d009bd2784347b0c100a7566d78ce Mon Sep 17 00:00:00 2001 From: Carlos Dauden Date: Tue, 4 Jun 2024 18:17:35 +0200 Subject: [PATCH] [IMP] account_banking_mandate_contact: Show contact mandate account bank in invoice report TT49436 --- .../models/__init__.py | 1 + .../models/account_move.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 account_banking_mandate_contact/models/account_move.py diff --git a/account_banking_mandate_contact/models/__init__.py b/account_banking_mandate_contact/models/__init__.py index a9f523dd9f76..6e3674c46c96 100644 --- a/account_banking_mandate_contact/models/__init__.py +++ b/account_banking_mandate_contact/models/__init__.py @@ -1,3 +1,4 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from . import account_move from . import account_move_line from . import res_partner diff --git a/account_banking_mandate_contact/models/account_move.py b/account_banking_mandate_contact/models/account_move.py new file mode 100644 index 000000000000..1adc0fa3ab43 --- /dev/null +++ b/account_banking_mandate_contact/models/account_move.py @@ -0,0 +1,19 @@ +# Copyright 2024 Tecnativa - Carlos Dauden +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import models + + +class AccountMove(models.Model): + _inherit = "account.move" + + def partner_banks_to_show(self): + self.ensure_one() + p_shipping_bank_id = self.partner_shipping_id.valid_mandate_id.partner_bank_id + if ( + p_shipping_bank_id + and not self.partner_bank_id + and self.payment_mode_id.payment_method_id.code == "sepa_direct_debit" + ): + return p_shipping_bank_id + return super().partner_banks_to_show()