[IMP] tax_receipt_in_portal: pick report per company, hide missing PDFs
Some checks failed
pre-commit / pre-commit (pull_request) Failing after 1m30s
tests / test (pull_request) Failing after 1m41s

Replace the ``tax_receipt_in_portal.report_uuid`` system parameter by a
per-company setting, in Settings > Invoicing > Tax Receipts
(``res.company.tax_receipt_report_id``). Each receipt is rendered with
the report of its issuing company, not the current one: in the portal,
the current company is the website's. The selector only offers PDF Form
reports on ``l10n.fr.tax.receipt``; type and model are still checked at
rendering time since the report can be edited after selection.

The download buttons of the list and detail pages are only shown when
the PDF can actually be rendered: a valid report is configured for the
issuing company and no mapped field resolves to an empty value. The
checks are those of the rendering itself, exposed as a filter
(``_get_pdf_available_receipts``) and run in sudo to avoid false
negatives on field paths the donor cannot read. Otherwise a discreet
"PDF available soon" mention replaces the button, and the download URL
redirects to the receipt page.

The detail page download link now also carries the share token, so a
visitor reaching the page by token can download the PDF.
This commit is contained in:
Stéphan Sainléger
2026-10-23 13:00:01 +02:00
parent 73c0684623
commit 5eb3fe766b
11 changed files with 397 additions and 93 deletions

View File

@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-10-20 21:59+0000\n"
"PO-Revision-Date: 2026-10-20 21:59+0000\n"
"POT-Creation-Date: 2026-10-23 10:55+0000\n"
"PO-Revision-Date: 2026-10-23 10:55+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -27,6 +27,8 @@ msgid ""
"<i class=\"fa fa-download me-1\" role=\"img\"/>\n"
" <span>PDF</span>"
msgstr ""
"<i class=\"fa fa-download me-1\" role=\"img\"/>\n"
" <span>PDF</span>"
#. module: tax_receipt_in_portal
#: model_terms:ir.ui.view,arch_db:tax_receipt_in_portal.portal_tax_receipt_page
@@ -92,6 +94,16 @@ msgstr "Avertissement d'accès"
msgid "Amount"
msgstr "Montant"
#. module: tax_receipt_in_portal
#: model:ir.model,name:tax_receipt_in_portal.model_res_company
msgid "Companies"
msgstr "Sociétés"
#. module: tax_receipt_in_portal
#: model:ir.model,name:tax_receipt_in_portal.model_res_config_settings
msgid "Config Settings"
msgstr "Paramètres de configuration"
#. module: tax_receipt_in_portal
#: model:ir.model.fields,help:tax_receipt_in_portal.field_l10n_fr_tax_receipt__access_url
msgid "Customer Portal URL"
@@ -110,20 +122,32 @@ msgstr "Date de facture"
#. module: tax_receipt_in_portal
#. odoo-python
#: code:addons/tax_receipt_in_portal/models/l10n_fr_tax_receipt.py:0
msgid "No report found with report_uuid %(uuid)s, configured in %(param)s."
msgid ""
"No tax receipt report configured for company %(company)s. Select one in "
"Settings > Invoicing > Tax Receipts."
msgstr ""
"Aucun rapport trouvé avec le report_uuid %(uuid)s, configuré dans %(param)s."
"Aucun rapport de reçu fiscal configuré pour la société %(company)s. Sélectionnez-en un dans Paramètres > Facturation > Reçus fiscaux."
#. module: tax_receipt_in_portal
#. odoo-python
#: code:addons/tax_receipt_in_portal/models/l10n_fr_tax_receipt.py:0
msgid ""
"No tax receipt report configured. Set the system parameter %(param)s to the "
"report_uuid of the PDF Form report that renders tax receipts."
#: model_terms:ir.ui.view,arch_db:tax_receipt_in_portal.res_config_settings_view_form
msgid "PDF Form report used to render tax receipts downloaded from the portal"
msgstr ""
"Aucun rapport de reçu fiscal configuré. Renseignez le paramètre système "
"%(param)s avec le report_uuid du rapport PDF Form qui génère les reçus "
"fiscaux."
"Rapport PDF Form utilisé pour générer les reçus fiscaux téléchargés depuis le portail"
#. module: tax_receipt_in_portal
#: model:ir.model.fields,help:tax_receipt_in_portal.field_res_company__tax_receipt_report_id
#: model:ir.model.fields,help:tax_receipt_in_portal.field_res_config_settings__tax_receipt_report_id
msgid ""
"PDF Form report used to render the tax receipts issued by this company in "
"the portal. Without it, donors can see their receipts but not download them."
msgstr ""
"Rapport PDF Form utilisé pour générer dans le portail les reçus fiscaux émis par cette société. Sans lui, les donateurs voient leurs reçus mais ne peuvent pas les télécharger."
#. module: tax_receipt_in_portal
#: model_terms:ir.ui.view,arch_db:tax_receipt_in_portal.portal_my_tax_receipts
#: model_terms:ir.ui.view,arch_db:tax_receipt_in_portal.portal_tax_receipt_page
msgid "PDF available soon"
msgstr "PDF bientôt disponible"
#. module: tax_receipt_in_portal
#: model:ir.model.fields,field_description:tax_receipt_in_portal.field_l10n_fr_tax_receipt__access_url
@@ -165,10 +189,18 @@ msgstr "Jeton de sécurité"
msgid "Tax Receipt -"
msgstr "Reçu fiscal -"
#. module: tax_receipt_in_portal
#: model:ir.model.fields,field_description:tax_receipt_in_portal.field_res_company__tax_receipt_report_id
#: model:ir.model.fields,field_description:tax_receipt_in_portal.field_res_config_settings__tax_receipt_report_id
#: model_terms:ir.ui.view,arch_db:tax_receipt_in_portal.res_config_settings_view_form
msgid "Tax Receipt Report"
msgstr "Rapport de reçu fiscal"
#. module: tax_receipt_in_portal
#: model_terms:ir.ui.view,arch_db:tax_receipt_in_portal.portal_breadcrumbs_tax_receipt
#: model_terms:ir.ui.view,arch_db:tax_receipt_in_portal.portal_my_home_tax_receipt
#: model_terms:ir.ui.view,arch_db:tax_receipt_in_portal.portal_my_tax_receipts
#: model_terms:ir.ui.view,arch_db:tax_receipt_in_portal.res_config_settings_view_form
msgid "Tax Receipts"
msgstr "Reçus fiscaux"