Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions addons/l10n_se/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -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. """
Expand Down