diff --git a/account_invoice_custom_portal_report/README.rst b/account_invoice_custom_portal_report/README.rst new file mode 100644 index 0000000..14f157d --- /dev/null +++ b/account_invoice_custom_portal_report/README.rst @@ -0,0 +1,53 @@ +==================================== +Account Invoice Custom Portal Report +==================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-qrtl%2Fhls--custom-lightgray.png?logo=github + :target: https://github.com/qrtl/hls-custom/tree/12.0/account_invoice_custom_portal_report + :alt: qrtl/hls-custom + +|badge1| |badge2| |badge3| + +This module allows users to change the report template of the portal customer invoice view by setting up +the invoice report in the company. + +**Table of contents** + +.. contents:: + :local: + +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 smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Quartile + +Maintainers +~~~~~~~~~~~ + +This module is part of the `qrtl/hls-custom `_ project on GitHub. + +You are welcome to contribute. diff --git a/account_invoice_custom_portal_report/__init__.py b/account_invoice_custom_portal_report/__init__.py new file mode 100644 index 0000000..91c5580 --- /dev/null +++ b/account_invoice_custom_portal_report/__init__.py @@ -0,0 +1,2 @@ +from . import controllers +from . import models diff --git a/account_invoice_custom_portal_report/__manifest__.py b/account_invoice_custom_portal_report/__manifest__.py new file mode 100644 index 0000000..9ff545c --- /dev/null +++ b/account_invoice_custom_portal_report/__manifest__.py @@ -0,0 +1,13 @@ +# Copyright 2024 Quartile (https://www.quartile.co) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Account Invoice Custom Portal Report", + "version": "12.0.1.0.0", + "category": "Portal", + "license": "AGPL-3", + "author": "Quartile", + "website": "https://www.quartile.co", + "depends": ["account"], + "data": ["views/res_company_views.xml"], + "installable": True, +} diff --git a/account_invoice_custom_portal_report/controllers/__init__.py b/account_invoice_custom_portal_report/controllers/__init__.py new file mode 100644 index 0000000..8c3feb6 --- /dev/null +++ b/account_invoice_custom_portal_report/controllers/__init__.py @@ -0,0 +1 @@ +from . import portal diff --git a/account_invoice_custom_portal_report/controllers/portal.py b/account_invoice_custom_portal_report/controllers/portal.py new file mode 100644 index 0000000..7da0ec1 --- /dev/null +++ b/account_invoice_custom_portal_report/controllers/portal.py @@ -0,0 +1,16 @@ +# Copyright 2024 Quartile (https://www.quartile.co) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.addons.portal.controllers.portal import CustomerPortal +from odoo.http import request + + +class CustomerPortal(CustomerPortal): + def _show_report(self, model, report_type, report_ref, download=False): + if not (model._name == "account.invoice" and model.type == "out_invoice"): + return super()._show_report(model, report_type, report_ref, download) + invoice_report = request.env.user.company_id.customer_invoice_portal_report + if invoice_report: + external_id = invoice_report.get_external_id() + report_ref = external_id.get(invoice_report.id) + return super()._show_report(model, report_type, report_ref, download) diff --git a/account_invoice_custom_portal_report/i18n/ja.po b/account_invoice_custom_portal_report/i18n/ja.po new file mode 100644 index 0000000..44ed87d --- /dev/null +++ b/account_invoice_custom_portal_report/i18n/ja.po @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_invoice_custom_portal_report +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-06-24 07:35+0000\n" +"PO-Revision-Date: 2024-06-24 07:35+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_custom_portal_report +#: model:ir.model,name:account_invoice_custom_portal_report.model_res_company +msgid "Companies" +msgstr "会社" + +#. module: account_invoice_custom_portal_report +#: model:ir.model.fields,field_description:account_invoice_custom_portal_report.field_res_company__customer_invoice_portal_report +msgid "Customer Invoice Portal Report" +msgstr "顧客請求書レポート(ポータル)" + +#. module: account_invoice_custom_portal_report +#: model:ir.model.fields,help:account_invoice_custom_portal_report.field_res_company__customer_invoice_portal_report +msgid "This report template will be used in the customer portal to show the customer invoice." +msgstr "このレポートテンプレートはポータルで顧客請求書を表示するために使用されます。" diff --git a/account_invoice_custom_portal_report/models/__init__.py b/account_invoice_custom_portal_report/models/__init__.py new file mode 100644 index 0000000..aff44f3 --- /dev/null +++ b/account_invoice_custom_portal_report/models/__init__.py @@ -0,0 +1 @@ +from . import res_company diff --git a/account_invoice_custom_portal_report/models/res_company.py b/account_invoice_custom_portal_report/models/res_company.py new file mode 100644 index 0000000..55fae0e --- /dev/null +++ b/account_invoice_custom_portal_report/models/res_company.py @@ -0,0 +1,15 @@ +# Copyright 2024 Quartile (https://www.quartile.co) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResCompany(models.Model): + _inherit = "res.company" + + customer_invoice_portal_report = fields.Many2one( + "ir.actions.report", + domain="[('model', '=', 'account.invoice')]", + help="This report template will be used in the customer portal to " + "show the customer invoice.", + ) diff --git a/account_invoice_custom_portal_report/readme/DESCRIPTION.rst b/account_invoice_custom_portal_report/readme/DESCRIPTION.rst new file mode 100644 index 0000000..a05d36b --- /dev/null +++ b/account_invoice_custom_portal_report/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module allows users to change the report template of the portal customer invoice view by setting up +the invoice report in the company. diff --git a/account_invoice_custom_portal_report/static/description/index.html b/account_invoice_custom_portal_report/static/description/index.html new file mode 100644 index 0000000..45102ab --- /dev/null +++ b/account_invoice_custom_portal_report/static/description/index.html @@ -0,0 +1,408 @@ + + + + + + +Account Invoice Custom Portal Report + + + +
+

Account Invoice Custom Portal Report

+ + +

Beta License: AGPL-3 qrtl/hls-custom

+

This module allows users to change the report template of the portal customer invoice view by setting up +the invoice report in the company.

+

Table of contents

+ +
+

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 smashing it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Quartile
  • +
+
+
+

Maintainers

+

This module is part of the qrtl/hls-custom project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/account_invoice_custom_portal_report/views/res_company_views.xml b/account_invoice_custom_portal_report/views/res_company_views.xml new file mode 100644 index 0000000..924760f --- /dev/null +++ b/account_invoice_custom_portal_report/views/res_company_views.xml @@ -0,0 +1,15 @@ + + + + view.company.form + res.company + + + + + + + + + + diff --git a/setup/account_invoice_custom_portal_report/odoo/addons/account_invoice_custom_portal_report b/setup/account_invoice_custom_portal_report/odoo/addons/account_invoice_custom_portal_report new file mode 120000 index 0000000..1356945 --- /dev/null +++ b/setup/account_invoice_custom_portal_report/odoo/addons/account_invoice_custom_portal_report @@ -0,0 +1 @@ +../../../../account_invoice_custom_portal_report \ No newline at end of file diff --git a/setup/account_invoice_custom_portal_report/setup.py b/setup/account_invoice_custom_portal_report/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/account_invoice_custom_portal_report/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)