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
This commit is contained in:
Cédric Krier committed 2018-09-17 17:47:56 +02:00
1 parent de8e3812d1
commit 03ddb0f77b
1 file changed
+2 -2
+2 -2
View File
@@ -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: