Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

17.0[FIX][account_invoice_bank_details]: the module is setting by default bank account from the company #333

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading