diff --git a/l10n_be_cooperator_portal/README.rst b/l10n_be_cooperator_portal/README.rst new file mode 100644 index 000000000..eea87c0ef --- /dev/null +++ b/l10n_be_cooperator_portal/README.rst @@ -0,0 +1,79 @@ +============================= +Tax Shelter reports in Portal +============================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:3fbcb3b51707be9a6ec888029377322bbb87f1f065016d9845babaf192fe8262 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fcooperative-lightgray.png?logo=github + :target: https://github.com/OCA/cooperative/tree/14.0/l10n_be_cooperator_portal + :alt: OCA/cooperative +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/cooperative-14-0/cooperative-14-0-l10n_be_cooperator_portal + :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/cooperative&target_branch=14.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Give access to Tax Shelter Report in the website portal. + +**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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Coop IT Easy SC + +Contributors +~~~~~~~~~~~~ + +* `Coop IT Easy SC `_: + + * Rémy TAYMANS + * Vincent VAN ROSSEM + +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/cooperative `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/l10n_be_cooperator_portal/__init__.py b/l10n_be_cooperator_portal/__init__.py new file mode 100644 index 000000000..79c2b7a8e --- /dev/null +++ b/l10n_be_cooperator_portal/__init__.py @@ -0,0 +1,5 @@ +# SPDX-FileCopyrightText: 2018 Coop IT Easy SC +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +from . import controllers diff --git a/l10n_be_cooperator_portal/__manifest__.py b/l10n_be_cooperator_portal/__manifest__.py new file mode 100644 index 000000000..0450f8992 --- /dev/null +++ b/l10n_be_cooperator_portal/__manifest__.py @@ -0,0 +1,21 @@ +# SPDX-FileCopyrightText: 2018 Coop IT Easy SC +# SPDX-FileContributor: Rémy Taymans +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +{ + "name": "Tax Shelter reports in Portal", + "version": "16.0.1.0.0", + "depends": [ + "portal", + "l10n_be_cooperator", + ], + "summary": "Give access to Tax Shelter Report in the portal.", + "author": "Coop IT Easy SC, Odoo Community Association (OCA)", + "license": "AGPL-3", + "category": "Cooperative Management", + "website": "https://github.com/OCA/cooperative", + "data": [ + "views/portal_templates.xml", + ], +} diff --git a/l10n_be_cooperator_portal/controllers/__init__.py b/l10n_be_cooperator_portal/controllers/__init__.py new file mode 100644 index 000000000..018e2c7f8 --- /dev/null +++ b/l10n_be_cooperator_portal/controllers/__init__.py @@ -0,0 +1,5 @@ +# SPDX-FileCopyrightText: 2018 Coop IT Easy SC +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +from . import portal diff --git a/l10n_be_cooperator_portal/controllers/portal.py b/l10n_be_cooperator_portal/controllers/portal.py new file mode 100644 index 000000000..3bc707f04 --- /dev/null +++ b/l10n_be_cooperator_portal/controllers/portal.py @@ -0,0 +1,156 @@ +# SPDX-FileCopyrightText: 2018 Coop IT Easy SC +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +from werkzeug.exceptions import Forbidden + +from odoo import http +from odoo.exceptions import AccessError, MissingError +from odoo.http import request +from odoo.osv import expression + +from odoo.addons.portal.controllers.portal import CustomerPortal + + +class TaxShelterPortal(CustomerPortal): + def _prepare_home_portal_values(self, counters): + values = super()._prepare_home_portal_values(counters) + if "tax_shelter_count" in counters: + # sudo is needed because regular users don't have access to the + # tax.shelter.certificate model, even for their own records. + tax_shelter_count = ( + request.env["tax.shelter.certificate"] + .sudo() + .search_count(self._get_tax_shelter_certificates_domain()) + ) + values["tax_shelter_count"] = tax_shelter_count + return values + + def _tax_shelter_certificate_get_page_view_values( + self, tax_shelter_certificate, access_token, **kwargs + ): + values = { + "company_id": request.env.company, + "page_name": "tax_shelter_certificate", + "tax_shelter_certificate": tax_shelter_certificate, + } + return self._get_page_view_values( + tax_shelter_certificate, + access_token, + values, + "my_tax_shelter_certificates_history", + False, + **kwargs, + ) + + def _get_tax_shelter_certificates_domain(self): + partner = request.env.user.partner_id + return [ + ("partner_id", "=", partner.commercial_partner_id.id), + ("state", "in", ("validated", "sent")), + ] + + @http.route( + [ + "/my/tax_shelter_certificates", + ], + type="http", + auth="user", + website=True, + ) + def portal_my_tax_shelter_certificates(self, **kw): + """Render a page that lists the tax shelter reports: + * Tax Shelter Certificates + * Shares Certifcates + """ + values = self._prepare_my_tax_shelter_certificates_values() + tax_shelter_certificates = values["tax_shelter_certificates"] + request.session[ + "my_tax_shelter_certificates_history" + ] = tax_shelter_certificates.ids + return request.render( + "l10n_be_cooperator_portal.portal_my_tax_shelter_certificate", values + ) + + # this method is a copy of PortalAccount._prepare_my_invoices_values() + # from the account module in odoo 16, with a few changes (most notably: + # the pager has been removed). please update accordingly when porting to + # newer versions. + def _prepare_my_tax_shelter_certificates_values( + self, domain=None, url="/my/tax_shelter_certificates" + ): + values = self._prepare_portal_layout_values() + # sudo is needed because regular users don't have access to the + # tax.shelter.certificate model, even for their own records. + TaxShelterCertificate = request.env["tax.shelter.certificate"].sudo() + + domain = expression.AND( + [ + domain or [], + self._get_tax_shelter_certificates_domain(), + ] + ) + + # sorting, filtering and pager support has been removed because: + # * the number of records is very small + # * the ordering cannot be computed by the database because it is + # computed with declaration_id.fiscal_year. database ordering only + # works with fields on the model itself. + + values.update( + { + "company_id": request.env.company, + "tax_shelter_certificates": TaxShelterCertificate.search(domain).sorted( + key=lambda r: r.declaration_id.fiscal_year, reverse=True + ), + "page_name": "tax_shelter_certificate", + "default_url": url, + } + ) + return values + + @http.route( + ["/my/tax_shelter_certificates/"], + type="http", + auth="public", + website=True, + ) + def portal_my_tax_shelter_certificate_detail( + self, + certificate_id, + access_token=None, + report_type=None, + download=False, + certificate_type=None, + **kw + ): + partner = request.env.user.partner_id + try: + tax_shelter_certificate_sudo = self._document_check_access( + "tax.shelter.certificate", certificate_id, access_token + ) + if tax_shelter_certificate_sudo.partner_id != partner.commercial_partner_id: + raise Forbidden() + except (AccessError, MissingError): + return request.redirect("/my") + + if report_type in ("html", "pdf", "text") and certificate_type in ( + "subscription", + "shares", + ): + report_ref = "l10n_be_cooperator.action_tax_shelter_%s_report" % ( + certificate_type + ) + return self._show_report( + model=tax_shelter_certificate_sudo, + report_type=report_type, + report_ref=report_ref, + download=download, + ) + + values = self._tax_shelter_certificate_get_page_view_values( + tax_shelter_certificate_sudo, access_token, **kw + ) + return request.render( + "l10n_be_cooperator_portal.portal_tax_shelter_page", values + ) diff --git a/l10n_be_cooperator_portal/i18n/fr_BE.po b/l10n_be_cooperator_portal/i18n/fr_BE.po new file mode 100644 index 000000000..49c1f6d89 --- /dev/null +++ b/l10n_be_cooperator_portal/i18n/fr_BE.po @@ -0,0 +1,62 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_be_cooperator_portal +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: fr_BE\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: \n" + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_taxshelter_page +msgid " Shares Certificate" +msgstr " Attestation de parts" + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_taxshelter_page +msgid " Subscription Certificate" +msgstr " Certificat de souscription" + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_my_tax_shelter +msgid "Declaration Year" +msgstr "Année de déclaration" + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_my_tax_shelter +msgid "Draft Tax Shelter Certificate" +msgstr "Certificats Tax shelter brouillon" + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_taxshelter_page +msgid "Print Shares" +msgstr "Imprimer attestation de parts" + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_taxshelter_page +msgid "Print Subscription" +msgstr "Imprimer certificat de souscription" + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_my_home_menu_tax_shelter +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_my_home_tax_shelter +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_my_tax_shelter +msgid "Tax Shelter Certificates" +msgstr "Certificats Tax shelter" + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_my_tax_shelter +msgid "There are currently no tax shelter certificates for your account." +msgstr "Il n'y a actuellement aucun certificat Tax shelter pour votre compte." + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_my_tax_shelter +msgid "Total Amount" +msgstr "Montant total" diff --git a/l10n_be_cooperator_portal/i18n/it.po b/l10n_be_cooperator_portal/i18n/it.po new file mode 100644 index 000000000..c1b0014db --- /dev/null +++ b/l10n_be_cooperator_portal/i18n/it.po @@ -0,0 +1,65 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_be_cooperator_portal +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-09-20 17:52+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_taxshelter_page +msgid " Shares Certificate" +msgstr " Condividi cetificato" + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_taxshelter_page +msgid " Subscription Certificate" +msgstr " Crtificato di iscrizione" + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_my_tax_shelter +msgid "Declaration Year" +msgstr "Anno dichiarazione" + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_my_tax_shelter +msgid "Draft Tax Shelter Certificate" +msgstr "Bozza certficato scudo fiscale" + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_taxshelter_page +msgid "Print Shares" +msgstr "Stampa quote" + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_taxshelter_page +msgid "Print Subscription" +msgstr "Stampa iscrizione" + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_my_home_menu_tax_shelter +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_my_home_tax_shelter +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_my_tax_shelter +msgid "Tax Shelter Certificates" +msgstr "Certiicati scudo fiscale" + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_my_tax_shelter +msgid "There are currently no tax shelter certificates for your account." +msgstr "" +"Attualmente non ci sono certificati dello scudo fiscale per il tuo conto." + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_my_tax_shelter +msgid "Total Amount" +msgstr "Importo totale" diff --git a/l10n_be_cooperator_portal/i18n/l10n_be_cooperator_portal.pot b/l10n_be_cooperator_portal/i18n/l10n_be_cooperator_portal.pot new file mode 100644 index 000000000..6d2804ae9 --- /dev/null +++ b/l10n_be_cooperator_portal/i18n/l10n_be_cooperator_portal.pot @@ -0,0 +1,61 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_be_cooperator_portal +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \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: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_taxshelter_page +msgid " Shares Certificate" +msgstr "" + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_taxshelter_page +msgid " Subscription Certificate" +msgstr "" + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_my_tax_shelter +msgid "Declaration Year" +msgstr "" + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_my_tax_shelter +msgid "Draft Tax Shelter Certificate" +msgstr "" + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_taxshelter_page +msgid "Print Shares" +msgstr "" + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_taxshelter_page +msgid "Print Subscription" +msgstr "" + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_my_home_menu_tax_shelter +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_my_home_tax_shelter +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_my_tax_shelter +msgid "Tax Shelter Certificates" +msgstr "" + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_my_tax_shelter +msgid "There are currently no tax shelter certificates for your account." +msgstr "" + +#. module: l10n_be_cooperator_portal +#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_my_tax_shelter +msgid "Total Amount" +msgstr "" diff --git a/l10n_be_cooperator_portal/readme/CONTRIBUTORS.rst b/l10n_be_cooperator_portal/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..1c6df33e7 --- /dev/null +++ b/l10n_be_cooperator_portal/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* `Coop IT Easy SC `_: + + * Rémy TAYMANS + * Vincent VAN ROSSEM diff --git a/l10n_be_cooperator_portal/readme/DESCRIPTION.rst b/l10n_be_cooperator_portal/readme/DESCRIPTION.rst new file mode 100644 index 000000000..2424c42eb --- /dev/null +++ b/l10n_be_cooperator_portal/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module gives access to Tax Shelter reports in the website portal. diff --git a/l10n_be_cooperator_portal/readme/newsfragments/93.bugfix.0.rst b/l10n_be_cooperator_portal/readme/newsfragments/93.bugfix.0.rst new file mode 100644 index 000000000..5c1540291 --- /dev/null +++ b/l10n_be_cooperator_portal/readme/newsfragments/93.bugfix.0.rst @@ -0,0 +1 @@ +List only validated certificates. diff --git a/l10n_be_cooperator_portal/readme/newsfragments/93.bugfix.1.rst b/l10n_be_cooperator_portal/readme/newsfragments/93.bugfix.1.rst new file mode 100644 index 000000000..d26947140 --- /dev/null +++ b/l10n_be_cooperator_portal/readme/newsfragments/93.bugfix.1.rst @@ -0,0 +1 @@ +Fix title of portal pages. diff --git a/l10n_be_cooperator_portal/readme/newsfragments/93.bugfix.2.rst b/l10n_be_cooperator_portal/readme/newsfragments/93.bugfix.2.rst new file mode 100644 index 000000000..e4599d048 --- /dev/null +++ b/l10n_be_cooperator_portal/readme/newsfragments/93.bugfix.2.rst @@ -0,0 +1 @@ +Fix copyright statements: add missing ones and use the same format everywhere. diff --git a/l10n_be_cooperator_portal/readme/newsfragments/93.feature.0.rst b/l10n_be_cooperator_portal/readme/newsfragments/93.feature.0.rst new file mode 100644 index 000000000..419ff748d --- /dev/null +++ b/l10n_be_cooperator_portal/readme/newsfragments/93.feature.0.rst @@ -0,0 +1,2 @@ +Add buttons in the list of tax shelter certificates to allow to print them +directly without needing to open the page that only contains those buttons. diff --git a/l10n_be_cooperator_portal/static/description/icon.png b/l10n_be_cooperator_portal/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/l10n_be_cooperator_portal/static/description/icon.png differ diff --git a/l10n_be_cooperator_portal/static/description/index.html b/l10n_be_cooperator_portal/static/description/index.html new file mode 100644 index 000000000..497999c31 --- /dev/null +++ b/l10n_be_cooperator_portal/static/description/index.html @@ -0,0 +1,425 @@ + + + + + + +Tax Shelter reports in Portal + + + +
+

Tax Shelter reports in Portal

+ + +

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

+

Give access to Tax Shelter Report in the website portal.

+

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

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Coop IT Easy SC
  • +
+
+
+

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/cooperative project on GitHub.

+

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

+
+
+
+ + diff --git a/l10n_be_cooperator_portal/views/portal_templates.xml b/l10n_be_cooperator_portal/views/portal_templates.xml new file mode 100644 index 000000000..9733258a9 --- /dev/null +++ b/l10n_be_cooperator_portal/views/portal_templates.xml @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/setup/l10n_be_cooperator_portal/odoo/addons/l10n_be_cooperator_portal b/setup/l10n_be_cooperator_portal/odoo/addons/l10n_be_cooperator_portal new file mode 120000 index 000000000..1425390a8 --- /dev/null +++ b/setup/l10n_be_cooperator_portal/odoo/addons/l10n_be_cooperator_portal @@ -0,0 +1 @@ +../../../../l10n_be_cooperator_portal \ No newline at end of file diff --git a/setup/l10n_be_cooperator_portal/setup.py b/setup/l10n_be_cooperator_portal/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/l10n_be_cooperator_portal/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)