Skip to content
Draft
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
15 changes: 15 additions & 0 deletions addons/l10n_se/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,18 @@ def _l10n_se_check_payment_reference(self):
luhn.validate(invoice.payment_reference)
except Exception:
raise ValidationError(_("Vendor require OCR Number as payment reference. Payment reference isn't a valid OCR Number."))

@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()


Comment on lines +86 to +87

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra line here

def _post(self, soft=True):
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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job using context_today!

return super()._post(soft)
Comment on lines +88 to +92

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add # EXTENDS here too!