[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
This commit is contained in:
parent
8f6caf9785
commit
29bd622521
|
@ -129,7 +129,7 @@ class stock_history(osv.osv):
|
||||||
source
|
source
|
||||||
FROM
|
FROM
|
||||||
((SELECT
|
((SELECT
|
||||||
stock_move.id::text || '-' || quant.id::text AS id,
|
stock_move.id AS id,
|
||||||
quant.id AS quant_id,
|
quant.id AS quant_id,
|
||||||
stock_move.id AS move_id,
|
stock_move.id AS move_id,
|
||||||
dest_location.id AS location_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 is not null and dest_location.company_id is null) or
|
||||||
source_location.company_id != dest_location.company_id or
|
source_location.company_id != dest_location.company_id or
|
||||||
source_location.usage not in ('internal', 'transit'))
|
source_location.usage not in ('internal', 'transit'))
|
||||||
) UNION
|
) UNION ALL
|
||||||
(SELECT
|
(SELECT
|
||||||
'-' || stock_move.id::text || '-' || quant.id::text AS id,
|
(-1) * stock_move.id AS id,
|
||||||
quant.id AS quant_id,
|
quant.id AS quant_id,
|
||||||
stock_move.id AS move_id,
|
stock_move.id AS move_id,
|
||||||
source_location.id AS location_id,
|
source_location.id AS location_id,
|
||||||
|
|
Loading…
Reference in New Issue