From 6e06c54c8e72cdab892610734bf2617c06a47272 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 30 Oct 2017 13:49:01 +0100 Subject: [PATCH] [FIX] product: Inventory at Date does not show the correct valuation Fine tuning of this commit: 51d072db444bfd2dcad18122b502a4d3a98627f4 When clicking on the group of the Inventory at Date, the product.price.inventory must follow the same order as the read_group in stock.history. opw:747857 --- addons/product/models/product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product/models/product.py b/addons/product/models/product.py index c3c79628e5c..549aa9e4de3 100644 --- a/addons/product/models/product.py +++ b/addons/product/models/product.py @@ -562,7 +562,7 @@ class ProductProduct(models.Model): history = self.env['product.price.history'].search([ ('company_id', '=', company_id), ('product_id', 'in', self.ids), - ('datetime', '<=', date or fields.Datetime.now())], limit=1) + ('datetime', '<=', date or fields.Datetime.now())], order='datetime desc,id desc', limit=1) return history.cost or 0.0 def _need_procurement(self):