Skip to content

Commit

Permalink
Merge PR #93 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by huguesdk
  • Loading branch information
OCA-git-bot committed Feb 2, 2024
2 parents 36cbd02 + afb2ae1 commit 7b8889d
Show file tree
Hide file tree
Showing 19 changed files with 1,073 additions and 0 deletions.
79 changes: 79 additions & 0 deletions l10n_be_cooperator_portal/README.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/OCA/cooperative/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 <https://github.com/OCA/cooperative/issues/new?body=module:%20l10n_be_cooperator_portal%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
~~~~~~~

* Coop IT Easy SC

Contributors
~~~~~~~~~~~~

* `Coop IT Easy SC <https://coopiteasy.be>`_:

* Rémy TAYMANS <remy@coopiteasy.be>
* Vincent VAN ROSSEM <vincent@coopiteasy.be>

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 <https://github.com/OCA/cooperative/tree/14.0/l10n_be_cooperator_portal>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 5 additions & 0 deletions l10n_be_cooperator_portal/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2018 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from . import controllers
21 changes: 21 additions & 0 deletions l10n_be_cooperator_portal/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# SPDX-FileCopyrightText: 2018 Coop IT Easy SC
# SPDX-FileContributor: Rémy Taymans <remy@coopiteasy.be>
#
# 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",
],
}
5 changes: 5 additions & 0 deletions l10n_be_cooperator_portal/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2018 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from . import portal
156 changes: 156 additions & 0 deletions l10n_be_cooperator_portal/controllers/portal.py
Original file line number Diff line number Diff line change
@@ -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/<int:certificate_id>"],
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
)
62 changes: 62 additions & 0 deletions l10n_be_cooperator_portal/i18n/fr_BE.po
Original file line number Diff line number Diff line change
@@ -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 "<i class=\"fa fa-print\"/> Shares Certificate"
msgstr "<i class=\"fa fa-print\"/> Attestation de parts"

#. module: l10n_be_cooperator_portal
#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_taxshelter_page
msgid "<i class=\"fa fa-print\"/> Subscription Certificate"
msgstr "<i class=\"fa fa-print\"/> 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"
65 changes: 65 additions & 0 deletions l10n_be_cooperator_portal/i18n/it.po
Original file line number Diff line number Diff line change
@@ -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 <stefano.consolaro@mymage.it>\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 "<i class=\"fa fa-print\"/> Shares Certificate"
msgstr "<i class=\"fa fa-print\"/> Condividi cetificato"

#. module: l10n_be_cooperator_portal
#: model_terms:ir.ui.view,arch_db:l10n_be_cooperator_portal.portal_taxshelter_page
msgid "<i class=\"fa fa-print\"/> Subscription Certificate"
msgstr "<i class=\"fa fa-print\"/> 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"
Loading

0 comments on commit 7b8889d

Please sign in to comment.