Skip to content

Commit 5252ace

Browse files
committed
[IMP] l10_fr_account: show deliver date on invoice
New legislation in France to add delivery date on invoice. task-4908900
1 parent 6819f50 commit 5252ace

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

addons/l10n_fr_account/models/account_move.py

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

0 commit comments

Comments
 (0)