Skip to content

Commit 521e0b0

Browse files
authored
[6258][ADD] account_move_partner_bank (#103)
[6258][ADD] account_move_partner_bank (#103)
1 parent 01a3b88 commit 521e0b0

20 files changed

Lines changed: 1080 additions & 0 deletions
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
=========================
2+
Account Move Partner Bank
3+
=========================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:b0bbc6bb7b42a01fe927641c8dbfcbb8c0209dbd04a2cbf9176a5a4d32e4dcce
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--invoicing-lightgray.png?logo=github
20+
:target: https://github.com/OCA/account-invoicing/tree/18.0/account_move_partner_bank
21+
:alt: OCA/account-invoicing
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/account-invoicing-18-0/account-invoicing-18-0-account_move_partner_bank
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-invoicing&target_branch=18.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module adds a bank account field to partners and sets it as the
32+
Recipient Bank on account moves based on the configuration of the
33+
invoice's company.
34+
35+
The bank source configuration supports multiple source models, allowing
36+
the same logic to be reused for other models (e.g., sale.order) by
37+
calling ``bank_account_source_ids.get_bank_for_record(record)``.
38+
39+
Note: If you want to add a bank account field to other models related to
40+
account moves, you can extend the ``bank.account.mixin`` in a new module
41+
and simply add the bank account field to the views.
42+
43+
**Table of contents**
44+
45+
.. contents::
46+
:local:
47+
48+
Configuration
49+
=============
50+
51+
To set up a bank account for a partner:
52+
53+
- Go to the partner record.
54+
- Under the Invoicing/Accounting tab, set the Recipient Bank field. If
55+
the partner has a company set, you can only select a bank account
56+
linked to that company’s partner. If the partner has no company set,
57+
you can only select a bank account linked to the current company’s
58+
partner. This is a company-dependent field.
59+
60+
To set up a bank account for a sales team:
61+
62+
- Go to Sales > Configuration > Sales Teams.
63+
- Select a team and set the Recipient Bank field. You can only choose a
64+
bank account linked to the company's partner (i.e., one of the
65+
company’s own bank accounts).
66+
67+
To use bank accounts in invoices:
68+
69+
- Go to Settings → Companies.
70+
- Open a company record.
71+
- In the Bank Account Sources tab, create one or more records.
72+
73+
- Source Model: Select the model from which the bank field path is
74+
resolved (e.g., Account Move).
75+
- Bank Field Path: Enter the dot-path from the source model to a
76+
bank account (res.partner.bank), for example
77+
partner_id.bank_account_id or team_id.bank_account_id.
78+
79+
The bank account from the record with the highest priority (lowest
80+
sequence number) will be used first when assigning the bank on invoices.
81+
If no value is found, the system proceeds to the next record, and so on.
82+
83+
Bug Tracker
84+
===========
85+
86+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-invoicing/issues>`_.
87+
In case of trouble, please check there if your issue has already been reported.
88+
If you spotted it first, help us to smash it by providing a detailed and welcomed
89+
`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**>`_.
90+
91+
Do not contact contributors directly about support or help with technical issues.
92+
93+
Credits
94+
=======
95+
96+
Authors
97+
-------
98+
99+
* Quartile
100+
101+
Contributors
102+
------------
103+
104+
- ``Quartile <https://www.quartile.co>``\ \_\_:
105+
106+
- Aung Ko Ko Lin
107+
- Yoshi Tashiro
108+
109+
Maintainers
110+
-----------
111+
112+
This module is maintained by the OCA.
113+
114+
.. image:: https://odoo-community.org/logo.png
115+
:alt: Odoo Community Association
116+
:target: https://odoo-community.org
117+
118+
OCA, or the Odoo Community Association, is a nonprofit organization whose
119+
mission is to support the collaborative development of Odoo features and
120+
promote its widespread use.
121+
122+
.. |maintainer-yostashiro| image:: https://github.com/yostashiro.png?size=40px
123+
:target: https://github.com/yostashiro
124+
:alt: yostashiro
125+
.. |maintainer-aungkokolin1997| image:: https://github.com/aungkokolin1997.png?size=40px
126+
:target: https://github.com/aungkokolin1997
127+
:alt: aungkokolin1997
128+
129+
Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
130+
131+
|maintainer-yostashiro| |maintainer-aungkokolin1997|
132+
133+
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.
134+
135+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2025 Quartile (https://www.quartile.co)
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
{
4+
"name": "Account Move Partner Bank",
5+
"summary": "Configurable recipient bank account suggestion for invoices",
6+
"version": "18.0.1.0.0",
7+
"author": "Quartile, Odoo Community Association (OCA)",
8+
"website": "https://github.com/OCA/account-invoicing",
9+
"category": "Account",
10+
"license": "AGPL-3",
11+
"depends": ["account"],
12+
"data": [
13+
"security/ir.model.access.csv",
14+
"views/res_company_views.xml",
15+
"views/res_partner_views.xml",
16+
],
17+
"maintainers": ["yostashiro", "aungkokolin1997"],
18+
"installable": True,
19+
}
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * account_move_partner_bank
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 18.0+e\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2025-12-27 09:37+0000\n"
10+
"PO-Revision-Date: 2025-12-27 09:37+0000\n"
11+
"Last-Translator: \n"
12+
"Language-Team: \n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: \n"
17+
18+
#. module: account_move_partner_bank
19+
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_mixin__bank_account_id_domain
20+
#: model:ir.model.fields,field_description:account_move_partner_bank.field_res_partner__bank_account_id_domain
21+
#: model:ir.model.fields,field_description:account_move_partner_bank.field_res_users__bank_account_id_domain
22+
msgid "Bank Account Id Domain"
23+
msgstr "銀行口座IDドメイン"
24+
25+
#. module: account_move_partner_bank
26+
#: model:ir.model,name:account_move_partner_bank.model_bank_account_mixin
27+
msgid "Bank Account Mixin"
28+
msgstr "銀行口座Mixin"
29+
30+
#. module: account_move_partner_bank
31+
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_source__bank_field_path
32+
msgid "Bank Field Path"
33+
msgstr "銀行フィールドパス"
34+
35+
#. module: account_move_partner_bank
36+
#: model:ir.model,name:account_move_partner_bank.model_res_company
37+
msgid "Companies"
38+
msgstr "会社"
39+
40+
#. module: account_move_partner_bank
41+
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_source__company_id
42+
msgid "Company"
43+
msgstr "会社"
44+
45+
#. module: account_move_partner_bank
46+
#: model:ir.model,name:account_move_partner_bank.model_res_partner
47+
msgid "Contact"
48+
msgstr "連絡先"
49+
50+
#. module: account_move_partner_bank
51+
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_source__create_uid
52+
msgid "Created by"
53+
msgstr "作成者"
54+
55+
#. module: account_move_partner_bank
56+
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_source__create_date
57+
msgid "Created on"
58+
msgstr "作成日"
59+
60+
#. module: account_move_partner_bank
61+
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_source__display_name
62+
msgid "Display Name"
63+
msgstr "表示名"
64+
65+
#. module: account_move_partner_bank
66+
#: model:ir.model.fields,help:account_move_partner_bank.field_bank_account_source__bank_field_path
67+
msgid "Field path to res.partner.bank (e.g. partner_id.bank_account_id)."
68+
msgstr "銀行口座へのフィールドパス(例:partner_id.bank_account_id)"
69+
70+
#. module: account_move_partner_bank
71+
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_source__id
72+
msgid "ID"
73+
msgstr "ID"
74+
75+
#. module: account_move_partner_bank
76+
#. odoo-python
77+
#: code:addons/account_move_partner_bank/models/bank_account_source.py:0
78+
msgid "Invalid bank field path: %s"
79+
msgstr "無効な銀行フィールドパス: %s"
80+
81+
#. module: account_move_partner_bank
82+
#. odoo-python
83+
#: code:addons/account_move_partner_bank/models/bank_account_source.py:0
84+
msgid "Invalid path (last field must reference res.partner.bank): %s"
85+
msgstr "無効なパス(最後のフィールドはres.partner.bankを参照する必要があります): %s"
86+
87+
#. module: account_move_partner_bank
88+
#: model:ir.model,name:account_move_partner_bank.model_account_move
89+
msgid "Journal Entry"
90+
msgstr "仕訳"
91+
92+
#. module: account_move_partner_bank
93+
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_source__write_uid
94+
msgid "Last Updated by"
95+
msgstr "最終更新者"
96+
97+
#. module: account_move_partner_bank
98+
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_source__write_date
99+
msgid "Last Updated on"
100+
msgstr "最終更新日"
101+
102+
#. module: account_move_partner_bank
103+
#: model:ir.model,name:account_move_partner_bank.model_bank_account_source
104+
msgid "Bank Account Source"
105+
msgstr "銀行口座提案元"
106+
107+
#. module: account_move_partner_bank
108+
#: model:ir.model.fields,field_description:account_move_partner_bank.field_res_company__bank_account_source_ids
109+
#: model_terms:ir.ui.view,arch_db:account_move_partner_bank.view_company_form
110+
msgid "Bank Account Sources"
111+
msgstr "銀行口座提案元"
112+
113+
#. module: account_move_partner_bank
114+
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_mixin__bank_account_id
115+
#: model:ir.model.fields,field_description:account_move_partner_bank.field_res_partner__bank_account_id
116+
#: model:ir.model.fields,field_description:account_move_partner_bank.field_res_users__bank_account_id
117+
msgid "Recipient Bank"
118+
msgstr "受取銀行口座"
119+
120+
#. module: account_move_partner_bank
121+
#: model:ir.model.fields,help:account_move_partner_bank.field_res_partner__bank_account_id
122+
#: model:ir.model.fields,help:account_move_partner_bank.field_res_users__bank_account_id
123+
msgid ""
124+
"Select a bank account of the company's partner, or the current company's "
125+
"partner if no company is set."
126+
msgstr ""
127+
"会社の取引先の銀行口座を選択します。会社が設定されていない場合は、現在の会社の"
128+
"取引先の銀行口座を選択します。"
129+
130+
#. module: account_move_partner_bank
131+
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_source__sequence
132+
msgid "Sequence"
133+
msgstr "順序"
134+
135+
#. module: account_move_partner_bank
136+
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_source__source_model_id
137+
msgid "Source Model"
138+
msgstr "ソースモデル"
139+
140+
#. module: account_move_partner_bank
141+
#: model:ir.model.fields,help:account_move_partner_bank.field_bank_account_source__source_model_id
142+
msgid "The model from which the bank field path is resolved."
143+
msgstr "銀行フィールドパスの起点となるモデル"
144+
145+
#. module: account_move_partner_bank
146+
#: model_terms:ir.ui.view,arch_db:account_move_partner_bank.view_company_form
147+
msgid "e.g. partner_id.bank_account_id"
148+
msgstr "例: partner_id.bank_account_id"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from . import bank_account_mixin
2+
from . import bank_account_source
3+
from . import res_partner
4+
from . import res_company
5+
from . import account_move
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2025 Quartile (https://www.quartile.co)
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import api, models
5+
6+
7+
class AccountMove(models.Model):
8+
_inherit = "account.move"
9+
10+
@api.depends("bank_partner_id", "partner_id")
11+
def _compute_partner_bank_id(self):
12+
super()._compute_partner_bank_id()
13+
for move in self:
14+
if not move.is_inbound():
15+
continue
16+
bank = move.company_id.bank_account_source_ids.get_bank_for_record(move)
17+
if bank:
18+
move.partner_bank_id = bank
19+
return
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2025 Quartile (https://www.quartile.co)
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class BankAccountMixin(models.AbstractModel):
8+
_name = "bank.account.mixin"
9+
_description = "Bank Account Mixin"
10+
11+
bank_account_id = fields.Many2one(
12+
"res.partner.bank", string="Recipient Bank", copy=False
13+
)
14+
bank_account_id_domain = fields.Binary(compute="_compute_bank_account_id_domain")
15+
16+
def _compute_bank_account_id_domain(self):
17+
# Override in inheriting models if needed
18+
for record in self:
19+
record.bank_account_id_domain = []

0 commit comments

Comments
 (0)