From b34d4416042f64f57f4b71b52173be2fbc902332 Mon Sep 17 00:00:00 2001 From: baje-odoo Date: Thu, 3 Jul 2025 09:52:54 +0200 Subject: [PATCH] [FIX] l10n_fr_account: show delivery date on customer invoice Purpose ------- Comply with new French legislation requiring the delivery date to appear on customer invoices. This aims to increase transparency for buyers and meet legal obligations. Changes ------- - Added a `delivery_date` field in the invoice form for companies based in France. - Field is editable by the user and shown in the invoice header. - If no delivery date is provided, the invoice date is used as default. - Delivery date is also printed on the invoice layout (PDF report). - Aligned implementation with similar use cases in other localisations. How to test ----------- 1. Set the company country to France. 2. Go to Accounting > Customers > Invoices. 3. Open or create a customer invoice. 4. A new "Delivery Date" field should appear in the form header. 5. Leave it empty or set a specific date. 6. Save and print the invoice. 7. The delivery date should appear in the invoice header, defaulting to the invoice date if not manually set. task-4908872 --- addons/l10n_fr_account/models/account_move.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/addons/l10n_fr_account/models/account_move.py b/addons/l10n_fr_account/models/account_move.py index 0040694d77bcb..456845556f28c 100644 --- a/addons/l10n_fr_account/models/account_move.py +++ b/addons/l10n_fr_account/models/account_move.py @@ -19,3 +19,18 @@ def _get_view(self, view_id=None, view_type='form', **options): def _compute_l10n_fr_is_company_french(self): for record in self: record.l10n_fr_is_company_french = record.country_code in record.company_id._get_france_country_codes() + + @api.depends('country_code', 'move_type') + def _compute_show_delivery_date(self): + # EXTENDS 'account' + super()._compute_show_delivery_date() + for move in self: + if self.l10n_fr_is_company_french: + move.show_delivery_date = move.is_sale_document() + + def _post(self, soft=True): + res = super()._post(soft) + for move in self: + if move.show_delivery_date and not move.delivery_date: + move.delivery_date = move.invoice_date or fields.Date.context_today(self) + return res