diff --git a/addons/account_check_printing/models/account_payment.py b/addons/account_check_printing/models/account_payment.py index f349be9c621..fe85dc472f2 100644 --- a/addons/account_check_printing/models/account_payment.py +++ b/addons/account_check_printing/models/account_payment.py @@ -8,6 +8,18 @@ from odoo.tools.misc import formatLang, format_date INV_LINES_PER_STUB = 9 +class AccountPaymentRegister(models.TransientModel): + _inherit = "account.payment.register" + + @api.depends('payment_type', 'journal_id', 'partner_id') + def _compute_payment_method_id(self): + super()._compute_payment_method_id() + for record in self: + preferred = record.partner_id.with_company(record.company_id).property_payment_method_id + if (record.payment_type == 'outbound' + and preferred in record.journal_id.outbound_payment_method_line_ids.mapped('payment_method_id')): + record.payment_method_id = preferred + class AccountPayment(models.Model): _inherit = "account.payment"