Take the full partition as frame to get last value of cost

issue10861
review366091002
(grafted from ddb0a53aa41faf0790fbbe0ce474b9dca6c03c84)

--HG--
branch : 6.0
This commit is contained in:
Cédric Krier committed 2021-10-21 00:13:42 +02:00
1 parent 9b853f7895
commit dba80a28d8
1 file changed
+2
+2
View File
@@ -97,6 +97,7 @@ class ProductCostHistory(ModelSQL, ModelView):
if database.has_window_functions():
window = Window(
[move.effective_date, move.product],
frame='ROWS', start=None, end=None,
order_by=[move.write_date.asc, move.id.asc])
cost_price = LastValue(move.cost_price, window=window)
else:
@@ -124,6 +125,7 @@ class ProductCostHistory(ModelSQL, ModelView):
if database.has_window_functions():
window = Window(
[price_date, history.product],
frame='ROWS', start=None, end=None,
order_by=[price_datetime.asc])
cost_price = LastValue(history.cost_price, window=window)
else: