Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
25 changes: 21 additions & 4 deletions account_move_partner_bank/README.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=========================
Account Move Partner Bank
=========================
Expand All @@ -7,13 +11,13 @@ Account Move Partner Bank
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b0bbc6bb7b42a01fe927641c8dbfcbb8c0209dbd04a2cbf9176a5a4d32e4dcce
!! source digest: sha256:1533c70efdef6a414cea12989514e398be6037cea7a1c4fe8ed615f052a1a137
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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
.. |badge2| image:: https://img.shields.io/badge/license-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
Expand Down Expand Up @@ -55,7 +59,13 @@ To set up a bank account for a partner:
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.
partner. This is a company-dependent field. As with the other partner
accounting settings, the field is normally set on the commercial
entity, and it applies to all of its child contacts. A child contact
can still be given its own bank account (e.g. a branch that collects
on a different account than its head office): set the field on the
contact itself, and leave it empty to keep using the bank account of
the commercial entity.

To set up a bank account for a sales team:

Expand All @@ -74,12 +84,19 @@ To use bank accounts in invoices:
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.
commercial_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.

Use commercial_partner_id.bank_account_id (instead of
partner_id.bank_account_id) to resolve the partner's bank account from
its commercial entity, so that the invoices of the child contacts of a
company also get the bank account set on that company. To let a child
contact take precedence with its own bank account, add
partner_id.bank_account_id as a source with a lower sequence number.

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

Expand Down
20 changes: 10 additions & 10 deletions account_move_partner_bank/i18n/ja.po
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ msgstr "作成者"
msgid "Created on"
msgstr "作成日"

#. module: account_move_partner_bank
#: model_terms:ir.ui.view,arch_db:account_move_partner_bank.view_partner_property_form
msgid "Customer Invoices"
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"
Expand All @@ -67,6 +72,11 @@ msgstr "表示名"
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_terms:ir.ui.view,arch_db:account_move_partner_bank.view_partner_property_form
msgid "From the parent company"
msgstr "親会社から取得"

#. module: account_move_partner_bank
#: model:ir.model.fields,field_description:account_move_partner_bank.field_bank_account_source__id
msgid "ID"
Expand Down Expand Up @@ -117,16 +127,6 @@ msgstr "銀行口座提案元"
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"
Expand Down
4 changes: 4 additions & 0 deletions account_move_partner_bank/models/bank_account_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ def _check_bank_field_path(self):
def get_bank_for_record(self, record):
"""Find bank from sources for the given record."""
record.ensure_one()
if "company_id" in record._fields and record.company_id:
# The bank account fields in the path may be company-dependent (as on
# res.partner), so resolve them in the company of the record.
record = record.with_company(record.company_id)
sources = self.filtered(lambda s: s.source_model_id.model == record._name)
for source in sources:
bank = attrgetter(source.bank_field_path)(record) or False
Expand Down
6 changes: 1 addition & 5 deletions account_move_partner_bank/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ class ResPartner(models.Model):
_name = "res.partner"
_inherit = ["res.partner", "bank.account.mixin"]

bank_account_id = fields.Many2one(
company_dependent=True,
help="Select a bank account of the company's partner, or the current company's "
"partner if no company is set.",
)
bank_account_id = fields.Many2one(company_dependent=True)

@api.depends_context("company")
@api.depends("company_id")
Expand Down
12 changes: 12 additions & 0 deletions account_move_partner_bank/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ To set up a bank account for a partner:
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.
The field can be set on a child contact as well, so that a contact can be
invoiced with a bank account of its own (e.g. a branch that collects on a
different account than its head office). Whether the bank account of the parent
company applies to its child contacts depends on the bank account sources
configured below.

To set up a bank account for a sales team:

Expand All @@ -26,3 +31,10 @@ To use bank accounts in invoices:

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.

Sources can therefore be combined to let the bank account of a company apply to the
invoices of its child contacts, while a contact that has its own bank account still
takes precedence. To do so, configure the following two sources on Account Move:

- partner_id.bank_account_id, with the lower sequence number.
- commercial_partner_id.bank_account_id, with the higher sequence number.
62 changes: 39 additions & 23 deletions account_move_partner_bank/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>Account Move Partner Bank</title>
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>README.rst</title>
<style type="text/css">

/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/

Expand Down Expand Up @@ -359,16 +359,19 @@
</style>
</head>
<body>
<div class="document" id="account-move-partner-bank">
<h1 class="title">Account Move Partner Bank</h1>
<div class="document">


<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme"><img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" /></a>
<div class="section" id="account-move-partner-bank">
<h1>Account Move Partner Bank</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b0bbc6bb7b42a01fe927641c8dbfcbb8c0209dbd04a2cbf9176a5a4d32e4dcce
!! source digest: sha256:1533c70efdef6a414cea12989514e398be6037cea7a1c4fe8ed615f052a1a137
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/account-invoicing/tree/18.0/account_move_partner_bank"><img alt="OCA/account-invoicing" src="https://img.shields.io/badge/github-OCA%2Faccount--invoicing-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-invoicing-18-0/account-invoicing-18-0-account_move_partner_bank"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-invoicing&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/account-invoicing/tree/18.0/account_move_partner_bank"><img alt="OCA/account-invoicing" src="https://img.shields.io/badge/github-OCA%2Faccount--invoicing-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/account-invoicing-18-0/account-invoicing-18-0-account_move_partner_bank"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runboat.odoo-community.org/builds?repo=OCA/account-invoicing&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>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.</p>
Expand All @@ -381,26 +384,32 @@ <h1 class="title">Account Move Partner Bank</h1>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#configuration" id="toc-entry-1">Configuration</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
<li><a class="reference internal" href="#configuration" id="id1">Configuration</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<h2><a class="toc-backref" href="#id1">Configuration</a></h2>
<p>To set up a bank account for a partner:</p>
<ul class="simple">
<li>Go to the partner record.</li>
<li>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.</li>
partner. This is a company-dependent field. As with the other partner
accounting settings, the field is normally set on the commercial
entity, and it applies to all of its child contacts. A child contact
can still be given its own bank account (e.g. a branch that collects
on a different account than its head office): set the field on the
contact itself, and leave it empty to keep using the bank account of
the commercial entity.</li>
</ul>
<p>To set up a bank account for a sales team:</p>
<ul class="simple">
Expand All @@ -418,32 +427,38 @@ <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
resolved (e.g., Account Move).</li>
<li>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.</li>
commercial_partner_id.bank_account_id or team_id.bank_account_id.</li>
</ul>
</li>
</ul>
<p>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.</p>
<p>Use commercial_partner_id.bank_account_id (instead of
partner_id.bank_account_id) to resolve the partner’s bank account from
its commercial entity, so that the invoices of the child contacts of a
company also get the bank account set on that company. To let a child
contact take precedence with its own bank account, add
partner_id.bank_account_id as a source with a lower sequence number.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<h2><a class="toc-backref" href="#id2">Bug Tracker</a></h2>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-invoicing/issues">GitHub Issues</a>.
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
<a class="reference external" href="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**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#toc-entry-3">Credits</a></h1>
<h2><a class="toc-backref" href="#id3">Credits</a></h2>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
<h3><a class="toc-backref" href="#id4">Authors</a></h3>
<ul class="simple">
<li>Quartile</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<h3><a class="toc-backref" href="#id5">Contributors</a></h3>
<ul class="simple">
<li><tt class="docutils literal">Quartile <span class="pre">&lt;https://www.quartile.co&gt;</span></tt>__:<ul>
<li>Aung Ko Ko Lin</li>
Expand All @@ -453,18 +468,19 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<h3><a class="toc-backref" href="#id6">Maintainers</a></h3>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>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.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/yostashiro"><img alt="yostashiro" src="https://github.com/yostashiro.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/aungkokolin1997"><img alt="aungkokolin1997" src="https://github.com/aungkokolin1997.png?size=40px" /></a></p>
<p><a class="reference external" href="https://github.com/yostashiro"><img alt="yostashiro" src="https://github.com/yostashiro.png?size=40px" /></a> <a class="reference external" href="https://github.com/aungkokolin1997"><img alt="aungkokolin1997" src="https://github.com/aungkokolin1997.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-invoicing/tree/18.0/account_move_partner_bank">OCA/account-invoicing</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</div>
</body>
</html>
Loading
Loading