Skip to content

Commit

Permalink
17.0[FIX][account_invoice_bank_details]: the module is setting by def…
Browse files Browse the repository at this point in the history
…ault

the company bank account on vendor bills instead of proposing the one from the vendor
  • Loading branch information
leemannd committed Sep 3, 2024
1 parent 32d43ea commit 253bbdf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions account_invoice_bank_details/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
[
Expand All @@ -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()
1 change: 1 addition & 0 deletions account_invoice_bank_details/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
- [camptocamp](https://camptocamp.com):
- Vincent Renaville \<<https://www.camptocamp.com>\>
- Denis Leemann \<<https://www.camptocamp.com>\>
- [Trobz](https://trobz.com):
- Do Anh Duy \<<[email protected]>\>
4 changes: 3 additions & 1 deletion account_invoice_bank_details/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 253bbdf

Please sign in to comment.