Skip to content

Commit 1cc39b5

Browse files
committed
[IMP] l10n_fr: automatic display delivery date on fr invoices header
there was a new legislation in France and the delivery date has to appear on the invoices so now it appears automatically in the customer invoice header and write a date on the invoice layout even if none is specified when creating the invoice task-5231327
1 parent 9ae5720 commit 1cc39b5

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

addons/l10n_fr_account/models/account_move.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,19 @@ def _get_view(self, view_id=None, view_type='form', **options):
2020
def _compute_l10n_fr_is_company_french(self):
2121
for record in self:
2222
record.l10n_fr_is_company_french = record.country_code in record.company_id._get_france_country_codes()
23+
24+
@api.depends('country_code', 'move_type')
25+
def _compute_show_delivery_date(self):
26+
# EXTENDS 'account.move'
27+
super()._compute_show_delivery_date()
28+
for move in self:
29+
if move.l10n_fr_is_company_french:
30+
move.show_delivery_date = move.is_sale_document()
31+
32+
def _post(self, soft=True):
33+
# EXTENDS 'account.move'
34+
posted = super()._post(soft)
35+
for move in self:
36+
if move.show_delivery_date and not move.delivery_date:
37+
move.delivery_date = move.invoice_date or fields.Date.context_today(self)
38+
return posted

0 commit comments

Comments
 (0)