From 29bd62252158803cdad351a2966af6eeac4cca74 Mon Sep 17 00:00:00 2001 From: Nicolas Seinlet Date: Thu, 22 Oct 2015 14:56:13 +0200 Subject: [PATCH] [FIX] stock_account: stock history performance Using BIGINT id instead of Text - This doesn't change the behavior, just the variable type, while being much more efficient. Using `UNION ALL` instead of simple `UNION` - This doesn't change the behavior either, as the ids of each sub select cannot collide Closes #9197 opw-650598 --- addons/stock_account/wizard/stock_valuation_history.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/stock_account/wizard/stock_valuation_history.py b/addons/stock_account/wizard/stock_valuation_history.py index b86173ba3b1..e6218dbf036 100644 --- a/addons/stock_account/wizard/stock_valuation_history.py +++ b/addons/stock_account/wizard/stock_valuation_history.py @@ -129,7 +129,7 @@ class stock_history(osv.osv): source FROM ((SELECT - stock_move.id::text || '-' || quant.id::text AS id, + stock_move.id AS id, quant.id AS quant_id, stock_move.id AS move_id, dest_location.id AS location_id, @@ -156,9 +156,9 @@ class stock_history(osv.osv): (source_location.company_id is not null and dest_location.company_id is null) or source_location.company_id != dest_location.company_id or source_location.usage not in ('internal', 'transit')) - ) UNION + ) UNION ALL (SELECT - '-' || stock_move.id::text || '-' || quant.id::text AS id, + (-1) * stock_move.id AS id, quant.id AS quant_id, stock_move.id AS move_id, source_location.id AS location_id,