diff --git a/addons/l10n_se/models/account_move.py b/addons/l10n_se/models/account_move.py index ae7c2e687aa69e..25ed602b0c00f4 100644 --- a/addons/l10n_se/models/account_move.py +++ b/addons/l10n_se/models/account_move.py @@ -54,6 +54,22 @@ def _get_invoice_reference_se_ocr4_partner(self): self.ensure_one() return self._get_invoice_reference_se_ocr4(self.partner_id.ref if str(self.partner_id.ref).isdecimal() else str(self.partner_id.id)) + @api.depends('country_code', 'move_type') + def _compute_show_delivery_date(self): + # EXTENDS 'account' + super()._compute_show_delivery_date() + for move in self: + if move.country_code == 'SE': + move.show_delivery_date = move.is_sale_document() + + def _post(self, soft=True): + # EXTENDS 'account' + post = super()._post(soft) + for move in self: + if move.country_code == 'SE' and move.is_sale_document() and not move.delivery_date: + move.delivery_date = move.invoice_date or fields.Date.context_today(self) + return post + @api.onchange('partner_id') def _onchange_partner_id(self): """ If Vendor Bill and Vendor OCR is set, add it. """