From 03ddb0f77bc5bcd5066700b5b0cb562acab6ffa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 17 Sep 2018 17:47:56 +0200 Subject: [PATCH] Prevent create move at the closed period date The value stored in a period are at the date so it should be forbidden to create move ate this date and we can use the value up to this date. issue7489 review45721002 --- move.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/move.py b/move.py index 15a53b78c5..2300a3e653 100644 --- a/move.py +++ b/move.py @@ -479,7 +479,7 @@ class Move(Workflow, ModelSQL, ModelView): for move in moves: date = (move.effective_date if move.effective_date else move.planned_date) - if date and date < period.date: + if date and date <= period.date: cls.raise_user_error('period_closed', { 'move': move.rec_name, 'period': period.rec_name, @@ -1212,7 +1212,7 @@ class Move(Workflow, ModelSQL, ModelView): context.get('stock_assign')) elif PeriodCache: periods = Period.search([ - ('date', '<', context['stock_date_end']), + ('date', '<=', context['stock_date_end']), ('state', '=', 'closed'), ], order=[('date', 'DESC')], limit=1) if periods: