diff --git a/account_move_partner_bank/README.rst b/account_move_partner_bank/README.rst index 7bbeffa3..e1e7d8e3 100644 --- a/account_move_partner_bank/README.rst +++ b/account_move_partner_bank/README.rst @@ -7,7 +7,7 @@ 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 @@ -55,7 +55,12 @@ 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. 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: @@ -80,6 +85,15 @@ 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. + Bug Tracker =========== diff --git a/account_move_partner_bank/i18n/ja.po b/account_move_partner_bank/i18n/ja.po index 75ab92a3..afe17e73 100644 --- a/account_move_partner_bank/i18n/ja.po +++ b/account_move_partner_bank/i18n/ja.po @@ -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" @@ -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" @@ -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" diff --git a/account_move_partner_bank/models/bank_account_source.py b/account_move_partner_bank/models/bank_account_source.py index 2c1fd0f6..a166057b 100644 --- a/account_move_partner_bank/models/bank_account_source.py +++ b/account_move_partner_bank/models/bank_account_source.py @@ -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 diff --git a/account_move_partner_bank/models/res_partner.py b/account_move_partner_bank/models/res_partner.py index 0f8f29fc..ee226817 100644 --- a/account_move_partner_bank/models/res_partner.py +++ b/account_move_partner_bank/models/res_partner.py @@ -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") diff --git a/account_move_partner_bank/readme/CONFIGURE.md b/account_move_partner_bank/readme/CONFIGURE.md index 9a9b3f46..1503159e 100644 --- a/account_move_partner_bank/readme/CONFIGURE.md +++ b/account_move_partner_bank/readme/CONFIGURE.md @@ -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: @@ -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. diff --git a/account_move_partner_bank/static/description/index.html b/account_move_partner_bank/static/description/index.html index f330f9d0..dc9c4556 100644 --- a/account_move_partner_bank/static/description/index.html +++ b/account_move_partner_bank/static/description/index.html @@ -8,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -274,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -300,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -366,7 +367,7 @@

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 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/account-invoicing Translate me on Weblate Try me on Runboat

This module adds a bank account field to partners and sets it as the @@ -400,7 +401,12 @@

Configuration

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. 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: