[ADD] tax_receipt_in_portal: publish tax receipts on the portal
Some checks failed
pre-commit / pre-commit (pull_request) Failing after 1m32s
tests / test (pull_request) Failing after 38s

Let donors view and download their own tax receipts from
``/my/tax-receipts``: a paginated list, a detail page with the receipt
information, its invoices and the native portal chatter, and a PDF
download rendered on demand through the configured ``pdf_form`` report.

The PDF rendering is delegated to ``pdf_form_report`` and nothing is
archived: a confirmed receipt is frozen by ``l10n_fr_tax_receipt``, so
rendering it again yields the same document.

Two safety nets compensate third-party behaviors:

- report resolution by ``report_uuid`` (system parameter
  ``tax_receipt_in_portal.report_uuid``) with strict validation of
  report type and target model;
- a blank-field guard which resolves every mapped PDF field value
  before rendering, because ``pdf_form_report`` swallows resolution
  errors and would otherwise silently serve a receipt with a blank
  amount.

Access is enforced twice: a portal record rule (own commercial partner,
confirmed/sent state only) and an explicit controller domain that also
covers internal users browsing ``/my``.

Tested with 17 tests (portal isolation, draft exposure, chatter data
access, blank-field guard, report misconfiguration, private API
contract of ``pdf_form_report``), including a mutation check proving
the security tests fail when the record rule is opened.
This commit is contained in:
Stéphan Sainléger
2026-10-21 00:15:21 +02:00
parent e14eafed39
commit 73c0684623
13 changed files with 1589 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
# Copyright 2026 Elabore
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "tax_receipt_in_portal",
"version": "18.0.1.0.0",
"author": "Elabore",
"maintainer": "Elabore",
"website": "https://git.elabore.coop/elabore/account-tools",
"license": "AGPL-3",
"category": "Website",
"summary": "Let donors download their tax receipts from the portal",
"depends": [
"portal",
"l10n_fr_tax_receipt",
],
"data": [
"security/ir.model.access.csv",
"security/ir_rule.xml",
"views/portal_templates.xml",
],
"installable": True,
"application": False,
"auto_install": False,
}