Skip to content
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
135 changes: 135 additions & 0 deletions account_move_partner_bank/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
=========================
Account Move Partner Bank
=========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b0bbc6bb7b42a01fe927641c8dbfcbb8c0209dbd04a2cbf9176a5a4d32e4dcce
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--invoicing-lightgray.png?logo=github
:target: https://github.com/OCA/account-invoicing/tree/18.0/account_move_partner_bank
:alt: OCA/account-invoicing
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-invoicing-18-0/account-invoicing-18-0-account_move_partner_bank
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-invoicing&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module adds a bank account field to partners and sets it as the
Recipient Bank on account moves based on the configuration of the
invoice's company.

The bank source configuration supports multiple source models, allowing
the same logic to be reused for other models (e.g., sale.order) by
calling ``bank_account_source_ids.get_bank_for_record(record)``.

Note: If you want to add a bank account field to other models related to
account moves, you can extend the ``bank.account.mixin`` in a new module
and simply add the bank account field to the views.

**Table of contents**

.. contents::
:local:

Configuration
=============

To set up a bank account for a partner:

- Go to the partner record.
- Under the Invoicing/Accounting tab, set the Recipient Bank field. If
the partner has a company set, you can only select a bank account
linked to that company’s partner. If the partner has no company set,
you can only select a bank account linked to the current company’s
partner. This is a company-dependent field.

To set up a bank account for a sales team:

- Go to Sales > Configuration > Sales Teams.
- Select a team and set the Recipient Bank field. You can only choose a
bank account linked to the company's partner (i.e., one of the
company’s own bank accounts).

To use bank accounts in invoices:

- Go to Settings → Companies.
- Open a company record.
- In the Bank Account Sources tab, create one or more records.

- Source Model: Select the model from which the bank field path is
resolved (e.g., Account Move).
- Bank Field Path: Enter the dot-path from the source model to a
bank account (res.partner.bank), for example
partner_id.bank_account_id or team_id.bank_account_id.

The bank account from the record with the highest priority (lowest
sequence number) will be used first when assigning the bank on invoices.
If no value is found, the system proceeds to the next record, and so on.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-invoicing/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-invoicing/issues/new?body=module:%20account_move_partner_bank%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Quartile

Contributors
------------

- ``Quartile <https://www.quartile.co>``\ \_\_:

- Aung Ko Ko Lin
- Yoshi Tashiro

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-yostashiro| image:: https://github.com/yostashiro.png?size=40px
:target: https://github.com/yostashiro
:alt: yostashiro
.. |maintainer-aungkokolin1997| image:: https://github.com/aungkokolin1997.png?size=40px
:target: https://github.com/aungkokolin1997
:alt: aungkokolin1997

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-yostashiro| |maintainer-aungkokolin1997|

This module is part of the `OCA/account-invoicing <https://github.com/OCA/account-invoicing/tree/18.0/account_move_partner_bank>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions account_move_partner_bank/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
19 changes: 19 additions & 0 deletions account_move_partner_bank/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2025 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Account Move Partner Bank",
"summary": "Configurable recipient bank account suggestion for invoices",
"version": "18.0.1.0.0",
"author": "Quartile, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-invoicing",
"category": "Account",
"license": "AGPL-3",
"depends": ["account"],
"data": [
"security/ir.model.access.csv",
"views/res_company_views.xml",
"views/res_partner_views.xml",
],
"maintainers": ["yostashiro", "aungkokolin1997"],
"installable": True,
}
148 changes: 148 additions & 0 deletions account_move_partner_bank/i18n/ja.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_move_partner_bank
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-12-27 09:37+0000\n"
"PO-Revision-Date: 2025-12-27 09:37+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: account_move_partner_bank
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_mixin__bank_account_id_domain
#: model:ir.model.fields,field_description:account_move_partner_bank.field_res_partner__bank_account_id_domain
#: model:ir.model.fields,field_description:account_move_partner_bank.field_res_users__bank_account_id_domain
msgid "Bank Account Id Domain"
msgstr "銀行口座IDドメイン"

#. module: account_move_partner_bank
#: model:ir.model,name:account_move_partner_bank.model_bank_account_mixin
msgid "Bank Account Mixin"
msgstr "銀行口座Mixin"

#. module: account_move_partner_bank
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_source__bank_field_path
msgid "Bank Field Path"
msgstr "銀行フィールドパス"

#. module: account_move_partner_bank
#: model:ir.model,name:account_move_partner_bank.model_res_company
msgid "Companies"
msgstr "会社"

#. module: account_move_partner_bank
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_source__company_id
msgid "Company"
msgstr "会社"

#. module: account_move_partner_bank
#: model:ir.model,name:account_move_partner_bank.model_res_partner
msgid "Contact"
msgstr "連絡先"

#. module: account_move_partner_bank
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_source__create_uid
msgid "Created by"
msgstr "作成者"

#. module: account_move_partner_bank
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_source__create_date
msgid "Created on"
msgstr "作成日"

#. module: account_move_partner_bank
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_source__display_name
msgid "Display Name"
msgstr "表示名"

#. module: account_move_partner_bank
#: model:ir.model.fields,help:account_move_partner_bank.field_bank_account_source__bank_field_path
msgid "Field path to res.partner.bank (e.g. partner_id.bank_account_id)."
msgstr "銀行口座へのフィールドパス(例:partner_id.bank_account_id)"

#. module: account_move_partner_bank
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_source__id
msgid "ID"
msgstr "ID"

#. module: account_move_partner_bank
#. odoo-python
#: code:addons/account_move_partner_bank/models/bank_account_source.py:0
msgid "Invalid bank field path: %s"
msgstr "無効な銀行フィールドパス: %s"

#. module: account_move_partner_bank
#. odoo-python
#: code:addons/account_move_partner_bank/models/bank_account_source.py:0
msgid "Invalid path (last field must reference res.partner.bank): %s"
msgstr "無効なパス(最後のフィールドはres.partner.bankを参照する必要があります): %s"

#. module: account_move_partner_bank
#: model:ir.model,name:account_move_partner_bank.model_account_move
msgid "Journal Entry"
msgstr "仕訳"

#. module: account_move_partner_bank
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_source__write_uid
msgid "Last Updated by"
msgstr "最終更新者"

#. module: account_move_partner_bank
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_source__write_date
msgid "Last Updated on"
msgstr "最終更新日"

#. module: account_move_partner_bank
#: model:ir.model,name:account_move_partner_bank.model_bank_account_source
msgid "Bank Account Source"
msgstr "銀行口座提案元"

#. module: account_move_partner_bank
#: model:ir.model.fields,field_description:account_move_partner_bank.field_res_company__bank_account_source_ids
#: model_terms:ir.ui.view,arch_db:account_move_partner_bank.view_company_form
msgid "Bank Account Sources"
msgstr "銀行口座提案元"

#. module: account_move_partner_bank
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_mixin__bank_account_id
#: model:ir.model.fields,field_description:account_move_partner_bank.field_res_partner__bank_account_id
#: model:ir.model.fields,field_description:account_move_partner_bank.field_res_users__bank_account_id
msgid "Recipient Bank"
msgstr "受取銀行口座"

#. module: account_move_partner_bank
#: model:ir.model.fields,help:account_move_partner_bank.field_res_partner__bank_account_id
#: model:ir.model.fields,help:account_move_partner_bank.field_res_users__bank_account_id
msgid ""
"Select a bank account of the company's partner, or the current company's "
"partner if no company is set."
msgstr ""
"会社の取引先の銀行口座を選択します。会社が設定されていない場合は、現在の会社の"
"取引先の銀行口座を選択します。"

#. module: account_move_partner_bank
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_source__sequence
msgid "Sequence"
msgstr "順序"

#. module: account_move_partner_bank
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_source__source_model_id
msgid "Source Model"
msgstr "ソースモデル"

#. module: account_move_partner_bank
#: model:ir.model.fields,help:account_move_partner_bank.field_bank_account_source__source_model_id
msgid "The model from which the bank field path is resolved."
msgstr "銀行フィールドパスの起点となるモデル"

#. module: account_move_partner_bank
#: model_terms:ir.ui.view,arch_db:account_move_partner_bank.view_company_form
msgid "e.g. partner_id.bank_account_id"
msgstr "例: partner_id.bank_account_id"
5 changes: 5 additions & 0 deletions account_move_partner_bank/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from . import bank_account_mixin
from . import bank_account_source
from . import res_partner
from . import res_company
from . import account_move
19 changes: 19 additions & 0 deletions account_move_partner_bank/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2025 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, models


class AccountMove(models.Model):
_inherit = "account.move"

@api.depends("bank_partner_id", "partner_id")
def _compute_partner_bank_id(self):
super()._compute_partner_bank_id()
for move in self:
if not move.is_inbound():
continue
bank = move.company_id.bank_account_source_ids.get_bank_for_record(move)
if bank:
move.partner_bank_id = bank
return
19 changes: 19 additions & 0 deletions account_move_partner_bank/models/bank_account_mixin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2025 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class BankAccountMixin(models.AbstractModel):
_name = "bank.account.mixin"
_description = "Bank Account Mixin"

bank_account_id = fields.Many2one(
"res.partner.bank", string="Recipient Bank", copy=False
)
bank_account_id_domain = fields.Binary(compute="_compute_bank_account_id_domain")

def _compute_bank_account_id_domain(self):
# Override in inheriting models if needed
for record in self:
record.bank_account_id_domain = []
Loading