From 9cef3a791551d5103bb0588522c4bb49b8fc9c55 Mon Sep 17 00:00:00 2001 From: michotm Date: Fri, 5 Jul 2019 09:29:41 +0200 Subject: [PATCH] [FIX] _check_lock_date in account_lock_to_date if move.company_id.period_lock_to_date or move.company_id.fiscalyear_lock_to_date are not set nothing should be done. --- account_lock_to_date/models/account_move.py | 8 ++++---- account_lock_to_date/static/description/index.html | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/account_lock_to_date/models/account_move.py b/account_lock_to_date/models/account_move.py index 28d9b146e..eb446dc3b 100644 --- a/account_lock_to_date/models/account_move.py +++ b/account_lock_to_date/models/account_move.py @@ -12,11 +12,11 @@ class AccountMove(models.Model): res = super()._check_lock_date() for move in self: lock_to_date = min( - move.company_id.period_lock_to_date or '0000-00-00', - move.company_id.fiscalyear_lock_to_date or '0000-00-00') + move.company_id.period_lock_to_date, + move.company_id.fiscalyear_lock_to_date) or False if self.user_has_groups('account.group_account_manager'): - lock_to_date = move.company_id.fiscalyear_lock_to_date - if lock_to_date and move.date >= (lock_to_date or '0000-00-00'): + lock_to_date = move.company_id.fiscalyear_lock_to_date or False + if lock_to_date and move.date >= lock_to_date: if self.user_has_groups('account.group_account_manager'): message = _("You cannot add/modify entries after and " "inclusive of the lock to date %s") % ( diff --git a/account_lock_to_date/static/description/index.html b/account_lock_to_date/static/description/index.html index eccfd4a51..b34ae40da 100644 --- a/account_lock_to_date/static/description/index.html +++ b/account_lock_to_date/static/description/index.html @@ -3,7 +3,7 @@ - + Account Lock To Date