From 1a71e6a12a89a48ce2d5e346fdcc90f342940d54 Mon Sep 17 00:00:00 2001 From: Maxime Richez Date: Wed, 28 Aug 2024 10:23:15 +0200 Subject: [PATCH] Use today as planned date for assigned move in stock moves by warehouse Closes #13417 (grafted from bc28a787ed0da0f87c769cde7a8920da01ba2cc7) --HG-- branch : 6.0 --- modules/stock/product.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/stock/product.py b/modules/stock/product.py index 21c4f51110..16f15ae10c 100644 --- a/modules/stock/product.py +++ b/modules/stock/product.py @@ -8,7 +8,7 @@ from copy import deepcopy from simpleeval import simple_eval -from sql import Literal, Select, Window, With +from sql import Literal, Null, Select, Window, With from sql.aggregate import Max, Sum from sql.conditionals import Coalesce, Case from sql.functions import CurrentTimestamp @@ -825,7 +825,10 @@ class ProductQuantitiesByWarehouseMove(ModelSQL, ModelView): warehouse = With('id', query=Location.search([ ('parent', 'child_of', [location_id]), ], query=True, order=[])) - date_column = Coalesce(move.effective_date, move.planned_date) + date_column = Coalesce( + move.effective_date, + Case((move.state == 'assigned', today), else_=Null), + move.planned_date) quantity = Case( (move.to_location.in_(warehouse.select(warehouse.id)), move.internal_quantity),