Skip to content

Commit 2cdfc5c

Browse files
committed
[IMP] account: make the delivery_date appears in the header of customer invoices for French based companies
1 parent e0a1783 commit 2cdfc5c

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
@@ -16,6 +16,22 @@ def _get_view(self, view_id=None, view_type='form', **options):
1616
shipping_fields[0].attrib.pop("groups", None)
1717
return arch, view
1818

19+
@api.depends('country_code', 'move_type')
20+
def _compute_show_delivery_date(self):
21+
# EXTENDS 'account'
22+
super()._compute_show_delivery_date()
23+
for move in self:
24+
if move.l10n_fr_is_company_french:
25+
move.show_delivery_date = move.is_sale_document()
26+
27+
def _post(self, soft=True):
28+
# EXTENDS 'account'
29+
posted = super()._post(soft)
30+
for move in self:
31+
if move.l10n_fr_is_company_french and move.is_sale_document() and not move.delivery_date:
32+
move.delivery_date = move.invoice_date or fields.Date.context_today(self)
33+
return posted
34+
1935
@api.depends('company_id.country_code')
2036
def _compute_l10n_fr_is_company_french(self):
2137
for record in self:

0 commit comments

Comments
 (0)