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()