From a9d56620d2bf59b26e52e4a463271d9c14029d82 Mon Sep 17 00:00:00 2001 From: Yolann Sabaux Date: Wed, 29 Mar 2023 13:43:30 +0000 Subject: [PATCH] [FIX] l10n_fr: enable invoice name on each page Steps to reproduce: - create an invoice with a certain number of items so that when printed there are multiple pages Issue: - the invoice name does not appear on each page According to the French legislation it is mandatory See https://entreprendre.service-public.fr/vosdroits/F31808 Solution: - set a config parameter specifically for l10n_fr in stable - set it in account directly for Master To allow the footer of the invoice to contain the name (and therefore the number) of the invoice opw-3199906 closes odoo/odoo#124989 X-original-commit: 7b071c995f1c9587cf4de56d6d1a632ea39db8ac Signed-off-by: Olivier Colson (oco) Signed-off-by: Yolann Sabaux (yosa) --- addons/account/models/ir_actions_report.py | 4 ++++ addons/l10n_fr/__manifest__.py | 1 + addons/l10n_fr/data/account_data.xml | 9 +++++++++ addons/web/views/report_templates.xml | 9 +++++++++ 4 files changed, 23 insertions(+) create mode 100644 addons/l10n_fr/data/account_data.xml diff --git a/addons/account/models/ir_actions_report.py b/addons/account/models/ir_actions_report.py index 50312a1bf61..8cf5b086615 100644 --- a/addons/account/models/ir_actions_report.py +++ b/addons/account/models/ir_actions_report.py @@ -49,8 +49,12 @@ class IrActionsReport(models.Model): def _render_qweb_pdf(self, report_ref, res_ids=None, data=None): # Check for reports only available for invoices. + # + append context data with the display_name_in_footer parameter if self._get_report(report_ref).report_name in ('account.report_invoice_with_payments', 'account.report_invoice'): invoices = self.env['account.move'].browse(res_ids) + if self.env['ir.config_parameter'].sudo().get_param('account.display_name_in_footer'): + data = data and dict(data) or {} + data.update({'display_name_in_footer': True}) if any(x.move_type == 'entry' for x in invoices): raise UserError(_("Only invoices could be printed.")) diff --git a/addons/l10n_fr/__manifest__.py b/addons/l10n_fr/__manifest__.py index e59e66ed1e2..072f08f0476 100644 --- a/addons/l10n_fr/__manifest__.py +++ b/addons/l10n_fr/__manifest__.py @@ -35,6 +35,7 @@ configuration of their taxes and fiscal positions manually. ], 'data': [ 'data/account_chart_template_data.xml', + 'data/account_data.xml', 'views/l10n_fr_view.xml', 'data/tax_report_data.xml', 'data/res_country_data.xml', diff --git a/addons/l10n_fr/data/account_data.xml b/addons/l10n_fr/data/account_data.xml new file mode 100644 index 00000000000..33373aaac36 --- /dev/null +++ b/addons/l10n_fr/data/account_data.xml @@ -0,0 +1,9 @@ + + + + + account.display_name_in_footer + True + + + diff --git a/addons/web/views/report_templates.xml b/addons/web/views/report_templates.xml index 5545f7134e9..f1bea053b90 100644 --- a/addons/web/views/report_templates.xml +++ b/addons/web/views/report_templates.xml @@ -333,6 +333,9 @@ of +
+ +
@@ -375,6 +378,9 @@
Page: /
+
+ +
@@ -470,6 +476,9 @@
Page: /
+
+ +