From 6d37ab9d278c81e077fa2dc34109934b062b35ff Mon Sep 17 00:00:00 2001 From: vrenaville Date: Fri, 8 Jan 2021 09:37:25 +0100 Subject: [PATCH 1/3] [V13] Add account invoice bank details --- account_invoice_bank_details/README.rst | 0 account_invoice_bank_details/__init__.py | 3 ++ account_invoice_bank_details/__manifest__.py | 16 ++++++++ account_invoice_bank_details/i18n/fr.po | 41 +++++++++++++++++++ .../models/__init__.py | 3 ++ .../models/account_move.py | 26 ++++++++++++ .../readme/CONTRIBUTORS.rst | 4 ++ .../readme/DESCRIPTION.rst | 3 ++ .../readme/ROADMAP.rst | 0 account_invoice_bank_details/readme/USAGE.rst | 0 .../views/invoice_report_templates.xml | 25 +++++++++++ 11 files changed, 121 insertions(+) create mode 100644 account_invoice_bank_details/README.rst create mode 100644 account_invoice_bank_details/__init__.py create mode 100644 account_invoice_bank_details/__manifest__.py create mode 100644 account_invoice_bank_details/i18n/fr.po create mode 100644 account_invoice_bank_details/models/__init__.py create mode 100644 account_invoice_bank_details/models/account_move.py create mode 100644 account_invoice_bank_details/readme/CONTRIBUTORS.rst create mode 100644 account_invoice_bank_details/readme/DESCRIPTION.rst create mode 100644 account_invoice_bank_details/readme/ROADMAP.rst create mode 100644 account_invoice_bank_details/readme/USAGE.rst create mode 100644 account_invoice_bank_details/views/invoice_report_templates.xml diff --git a/account_invoice_bank_details/README.rst b/account_invoice_bank_details/README.rst new file mode 100644 index 000000000..e69de29bb diff --git a/account_invoice_bank_details/__init__.py b/account_invoice_bank_details/__init__.py new file mode 100644 index 000000000..83e553ac4 --- /dev/null +++ b/account_invoice_bank_details/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/account_invoice_bank_details/__manifest__.py b/account_invoice_bank_details/__manifest__.py new file mode 100644 index 000000000..b0475f6ea --- /dev/null +++ b/account_invoice_bank_details/__manifest__.py @@ -0,0 +1,16 @@ +{ + "name": "Invoice bank account details", + "summary": "Select bank account base on currency + print bank details on report" + "reports and customer portal", + "version": "13.0.1.0.0", + "category": "Sales Management", + "website": "http://github.com/OCA/account-invoice-repoting", + "author": "Camptocamp, " "Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": ["account"], + "data": [ + "views/invoice_report_templates.xml", + ], + "application": False, + "installable": True, +} diff --git a/account_invoice_bank_details/i18n/fr.po b/account_invoice_bank_details/i18n/fr.po new file mode 100644 index 000000000..7f38cac6f --- /dev/null +++ b/account_invoice_bank_details/i18n/fr.po @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_invoice_bank_details +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-01-08 08:32+0000\n" +"PO-Revision-Date: 2021-01-08 08:32+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_invoice_bank_details +#: model_terms:ir.ui.view,arch_db:account_invoice_bank_details.report_invoice_document_hide_detail +msgid "BIC / SWIFT:" +msgstr "" + +#. module: account_invoice_bank_details +#: model_terms:ir.ui.view,arch_db:account_invoice_bank_details.report_invoice_document_hide_detail +msgid "Bank:" +msgstr "Banque:" + +#. module: account_invoice_bank_details +#: model_terms:ir.ui.view,arch_db:account_invoice_bank_details.report_invoice_document_hide_detail +msgid "IBAN:" +msgstr "" + +#. module: account_invoice_bank_details +#: model_terms:ir.ui.view,arch_db:account_invoice_bank_details.report_invoice_document_hide_detail +msgid "Payment information:" +msgstr "Payable auprès de:" + +#. module: account_invoice_bank_details +#: model:ir.model,name:account_invoice_bank_details.model_account_move +msgid "Journal Entries" +msgstr "Pièces comptables" diff --git a/account_invoice_bank_details/models/__init__.py b/account_invoice_bank_details/models/__init__.py new file mode 100644 index 000000000..4951448be --- /dev/null +++ b/account_invoice_bank_details/models/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import account_move diff --git a/account_invoice_bank_details/models/account_move.py b/account_invoice_bank_details/models/account_move.py new file mode 100644 index 000000000..d8075261c --- /dev/null +++ b/account_invoice_bank_details/models/account_move.py @@ -0,0 +1,26 @@ +# Copyright 2020-2021 Camptocamp - Vincent Renaville +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models, api + + +class AccountMove(models.Model): + _inherit = "account.move" + + @api.onchange('currency_id') + def _onchange_currency_id(self): + # try to find bank account by currency + bank = self.env['res.partner.bank'].search([ + ('currency_id', '=', self.currency_id.id), + ('partner_id', '=', self.company_id.partner_id.id), + ], limit=1) + # if not found take first bank account of the company + if not bank: + bank = self.env['res.partner.bank'].search( + [('partner_id', '=', self.company_id.partner_id.id)], + limit=1 + ) + + self.invoice_partner_bank_id = bank.id + + diff --git a/account_invoice_bank_details/readme/CONTRIBUTORS.rst b/account_invoice_bank_details/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..72a5cbbca --- /dev/null +++ b/account_invoice_bank_details/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* `Camptocamp `_: + + * Vincent Renaville + \ No newline at end of file diff --git a/account_invoice_bank_details/readme/DESCRIPTION.rst b/account_invoice_bank_details/readme/DESCRIPTION.rst new file mode 100644 index 000000000..e9dbe8aa4 --- /dev/null +++ b/account_invoice_bank_details/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +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 diff --git a/account_invoice_bank_details/readme/ROADMAP.rst b/account_invoice_bank_details/readme/ROADMAP.rst new file mode 100644 index 000000000..e69de29bb diff --git a/account_invoice_bank_details/readme/USAGE.rst b/account_invoice_bank_details/readme/USAGE.rst new file mode 100644 index 000000000..e69de29bb diff --git a/account_invoice_bank_details/views/invoice_report_templates.xml b/account_invoice_bank_details/views/invoice_report_templates.xml new file mode 100644 index 000000000..0e7371709 --- /dev/null +++ b/account_invoice_bank_details/views/invoice_report_templates.xml @@ -0,0 +1,25 @@ + + + + + From 9329d412f1c0073c9e03e13e3f7d438b3eb431ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Duy=20=28=C4=90=E1=BB=97=20Anh=29?= <¨duyda@trobz.com¨> Date: Fri, 7 Jun 2024 15:21:02 +0700 Subject: [PATCH 2/3] [IMP] account_invoice_bank_details: pre-commit auto fixes --- account_invoice_bank_details/README.rst | 90 ++++ account_invoice_bank_details/__manifest__.py | 2 +- .../models/account_move.py | 24 +- account_invoice_bank_details/pyproject.toml | 3 + .../readme/CONTRIBUTORS.md | 2 + .../readme/CONTRIBUTORS.rst | 4 - .../readme/DESCRIPTION.md | 3 + .../readme/DESCRIPTION.rst | 3 - .../readme/ROADMAP.md | 1 + .../readme/ROADMAP.rst | 0 account_invoice_bank_details/readme/USAGE.md | 1 + account_invoice_bank_details/readme/USAGE.rst | 0 .../static/description/index.html | 436 ++++++++++++++++++ .../views/invoice_report_templates.xml | 14 +- 14 files changed, 557 insertions(+), 26 deletions(-) create mode 100644 account_invoice_bank_details/pyproject.toml create mode 100644 account_invoice_bank_details/readme/CONTRIBUTORS.md delete mode 100644 account_invoice_bank_details/readme/CONTRIBUTORS.rst create mode 100644 account_invoice_bank_details/readme/DESCRIPTION.md delete mode 100644 account_invoice_bank_details/readme/DESCRIPTION.rst create mode 100644 account_invoice_bank_details/readme/ROADMAP.md delete mode 100644 account_invoice_bank_details/readme/ROADMAP.rst create mode 100644 account_invoice_bank_details/readme/USAGE.md delete mode 100644 account_invoice_bank_details/readme/USAGE.rst create mode 100644 account_invoice_bank_details/static/description/index.html diff --git a/account_invoice_bank_details/README.rst b/account_invoice_bank_details/README.rst index e69de29bb..73f1d428d 100644 --- a/account_invoice_bank_details/README.rst +++ b/account_invoice_bank_details/README.rst @@ -0,0 +1,90 @@ +============================ +Invoice bank account details +============================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:657b7f7cf034140aacc1399eb1719ee731e5822db3867f71a6ed769e1a8f739d + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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--invoice--reporting-lightgray.png?logo=github + :target: https://github.com/OCA/account-invoice-reporting/tree/17.0/account_invoice_bank_details + :alt: OCA/account-invoice-reporting +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/account-invoice-reporting-17-0/account-invoice-reporting-17-0-account_invoice_bank_details + :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-invoice-reporting&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +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 + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + + + +Known issues / Roadmap +====================== + + + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Camptocamp + +Contributors +------------ + +- `Camptocamp `__: + + - Vincent Renaville + +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. + +This module is part of the `OCA/account-invoice-reporting `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_invoice_bank_details/__manifest__.py b/account_invoice_bank_details/__manifest__.py index b0475f6ea..60145ed8e 100644 --- a/account_invoice_bank_details/__manifest__.py +++ b/account_invoice_bank_details/__manifest__.py @@ -4,7 +4,7 @@ "reports and customer portal", "version": "13.0.1.0.0", "category": "Sales Management", - "website": "http://github.com/OCA/account-invoice-repoting", + "website": "https://github.com/OCA/account-invoice-reporting", "author": "Camptocamp, " "Odoo Community Association (OCA)", "license": "AGPL-3", "depends": ["account"], diff --git a/account_invoice_bank_details/models/account_move.py b/account_invoice_bank_details/models/account_move.py index d8075261c..e09694f34 100644 --- a/account_invoice_bank_details/models/account_move.py +++ b/account_invoice_bank_details/models/account_move.py @@ -1,26 +1,26 @@ # Copyright 2020-2021 Camptocamp - Vincent Renaville # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo import fields, models, api +from odoo import api, models class AccountMove(models.Model): _inherit = "account.move" - @api.onchange('currency_id') + @api.onchange("currency_id") def _onchange_currency_id(self): # try to find bank account by currency - bank = self.env['res.partner.bank'].search([ - ('currency_id', '=', self.currency_id.id), - ('partner_id', '=', self.company_id.partner_id.id), - ], limit=1) + bank = self.env["res.partner.bank"].search( + [ + ("currency_id", "=", self.currency_id.id), + ("partner_id", "=", self.company_id.partner_id.id), + ], + limit=1, + ) # if not found take first bank account of the company if not bank: - bank = self.env['res.partner.bank'].search( - [('partner_id', '=', self.company_id.partner_id.id)], - limit=1 + bank = self.env["res.partner.bank"].search( + [("partner_id", "=", self.company_id.partner_id.id)], limit=1 ) - - self.invoice_partner_bank_id = bank.id - + self.invoice_partner_bank_id = bank.id diff --git a/account_invoice_bank_details/pyproject.toml b/account_invoice_bank_details/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/account_invoice_bank_details/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/account_invoice_bank_details/readme/CONTRIBUTORS.md b/account_invoice_bank_details/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..dfe83e851 --- /dev/null +++ b/account_invoice_bank_details/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- [Camptocamp](https://www.camptocamp.com): + - Vincent Renaville diff --git a/account_invoice_bank_details/readme/CONTRIBUTORS.rst b/account_invoice_bank_details/readme/CONTRIBUTORS.rst deleted file mode 100644 index 72a5cbbca..000000000 --- a/account_invoice_bank_details/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,4 +0,0 @@ -* `Camptocamp `_: - - * Vincent Renaville - \ No newline at end of file diff --git a/account_invoice_bank_details/readme/DESCRIPTION.md b/account_invoice_bank_details/readme/DESCRIPTION.md new file mode 100644 index 000000000..2439913d6 --- /dev/null +++ b/account_invoice_bank_details/readme/DESCRIPTION.md @@ -0,0 +1,3 @@ +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 diff --git a/account_invoice_bank_details/readme/DESCRIPTION.rst b/account_invoice_bank_details/readme/DESCRIPTION.rst deleted file mode 100644 index e9dbe8aa4..000000000 --- a/account_invoice_bank_details/readme/DESCRIPTION.rst +++ /dev/null @@ -1,3 +0,0 @@ -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 diff --git a/account_invoice_bank_details/readme/ROADMAP.md b/account_invoice_bank_details/readme/ROADMAP.md new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/account_invoice_bank_details/readme/ROADMAP.md @@ -0,0 +1 @@ + diff --git a/account_invoice_bank_details/readme/ROADMAP.rst b/account_invoice_bank_details/readme/ROADMAP.rst deleted file mode 100644 index e69de29bb..000000000 diff --git a/account_invoice_bank_details/readme/USAGE.md b/account_invoice_bank_details/readme/USAGE.md new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/account_invoice_bank_details/readme/USAGE.md @@ -0,0 +1 @@ + diff --git a/account_invoice_bank_details/readme/USAGE.rst b/account_invoice_bank_details/readme/USAGE.rst deleted file mode 100644 index e69de29bb..000000000 diff --git a/account_invoice_bank_details/static/description/index.html b/account_invoice_bank_details/static/description/index.html new file mode 100644 index 000000000..b8e14c596 --- /dev/null +++ b/account_invoice_bank_details/static/description/index.html @@ -0,0 +1,436 @@ + + + + + +Invoice bank account details + + + +
+

Invoice bank account details

+ + +

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

+

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

+

Table of contents

+ +
+

Usage

+
+ +
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Camptocamp
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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.

+

This module is part of the OCA/account-invoice-reporting project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/account_invoice_bank_details/views/invoice_report_templates.xml b/account_invoice_bank_details/views/invoice_report_templates.xml index 0e7371709..83b5a8425 100644 --- a/account_invoice_bank_details/views/invoice_report_templates.xml +++ b/account_invoice_bank_details/views/invoice_report_templates.xml @@ -1,25 +1,27 @@ - + -