diff --git a/account_invoice_bank_details/models/account_move.py b/account_invoice_bank_details/models/account_move.py index a1d84d287..cc94a0658 100644 --- a/account_invoice_bank_details/models/account_move.py +++ b/account_invoice_bank_details/models/account_move.py @@ -9,8 +9,10 @@ class AccountMove(models.Model): @api.depends("currency_id", "company_id.partner_id") def _compute_partner_bank_id(self): + # Override the method to set the first matching bank account in currency of + # the company. It is done only for customer invoices and refunds. for record in self: - if record.currency_id: + if record.currency_id and record.move_type in ["out_invoice", "out_refund"]: # try to find bank account by currency partner_bank = self.env["res.partner.bank"].search( [ @@ -27,6 +29,5 @@ def _compute_partner_bank_id(self): ) record.partner_bank_id = partner_bank.id - else: - return super()._compute_partner_bank_id + return super()._compute_partner_bank_id() diff --git a/account_invoice_bank_details/readme/CONTRIBUTORS.md b/account_invoice_bank_details/readme/CONTRIBUTORS.md index d097aa7a5..d0e67da28 100644 --- a/account_invoice_bank_details/readme/CONTRIBUTORS.md +++ b/account_invoice_bank_details/readme/CONTRIBUTORS.md @@ -1,4 +1,5 @@ - [camptocamp](https://camptocamp.com): - Vincent Renaville \<\> +- Denis Leemann \<\> - [Trobz](https://trobz.com): - Do Anh Duy \<\> diff --git a/account_invoice_bank_details/readme/DESCRIPTION.md b/account_invoice_bank_details/readme/DESCRIPTION.md index 2439913d6..d9c560e98 100644 --- a/account_invoice_bank_details/readme/DESCRIPTION.md +++ b/account_invoice_bank_details/readme/DESCRIPTION.md @@ -1,3 +1,5 @@ This module allows you to select a default bank account based on the currency of the invoice. It will also display the bank details on the -invoice +invoice. + +Nota Bene: it is done on customer invoices/refund, not on vendor bills