From 6748a21943b01d2000cef2aad1b69a233caec14a Mon Sep 17 00:00:00 2001 From: yagho-odoo Date: Tue, 4 Nov 2025 17:06:54 +0100 Subject: [PATCH] [IMP] l10n_fr_account: show delivery dates in the invoice header A new legislation in france requires the delivery date to be in the header of the invoice, if no delivery date is added at invoice creation, it is set to the invoice date by default task-5231299 --- 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 ff6f3aca58f49..7b1e22faa9f73 100644 --- a/addons/l10n_fr_account/models/account_move.py +++ b/addons/l10n_fr_account/models/account_move.py @@ -6,6 +6,14 @@ class AccountMove(models.Model): l10n_fr_is_company_french = fields.Boolean(compute='_compute_l10n_fr_is_company_french') + @api.depends('l10n_fr_is_company_french') + def _compute_show_delivery_date(self): + # EXTENDS 'account' + super()._compute_show_delivery_date() + for move in self: + if move.l10n_fr_is_company_french: + move.show_delivery_date = move.is_sale_document() + @api.model def _get_view(self, view_id=None, view_type='form', **options): arch, view = super()._get_view(view_id, view_type, **options) @@ -20,3 +28,10 @@ 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() + + def _post(self, soft=True): + res = super()._post(soft) + for move in self: + if move.l10n_fr_is_company_french and move.is_sale_document() and not move.delivery_date: + move.delivery_date = move.invoice_date + return res