Use today as planned date for assigned move in stock moves by warehouse

Closes #13417
(grafted from bc28a787ed0da0f87c769cde7a8920da01ba2cc7)

--HG--
branch : 6.0
This commit is contained in:
Maxime Richez committed 2024-08-28 10:23:15 +02:00
1 parent a6ae7465ae
commit 1a71e6a12a
1 file changed
+5 -2
+5 -2
View File
@@ -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),