[FIX] account_check_printing: wizard use vendor payment method
The payment method added by account_check_printing is meant as: > Preferred payment method when paying this vendor. This is used to > filter vendor bills by preferred payment method to register payments > in mass. Use cases: create bank files for batch wires, check runs. But it may also select the default payment method on an account.payment. With this changeset, we copy what is done in account.payment to account.payment.register so the behavior is the same for it. forward-port of #72655 opw-2508263 X-original-commit: a546e7e870987e882ab2c9a6fa2618476b76fcb8
This commit is contained in:
committed by
Nicolas Lempereur
parent
5cee367966
commit
45b378f1f0
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user