From d951a7d5eecadfa15758a103e2ba1971468b24c1 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 21 Apr 2016 11:24:49 +0200 Subject: [PATCH] [FIX] stock_account: stock history view The stock history doesn't take into account internal moves. For example, in the following situation: - Receive 1000 products to Internal Warehouse 1 - Move these 1000 products to Internal Warehouse 2 The 1000 products are still recorded on the Internal Warehouse 1. opw-672277 --- addons/stock_account/wizard/stock_valuation_history.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/addons/stock_account/wizard/stock_valuation_history.py b/addons/stock_account/wizard/stock_valuation_history.py index fad5a454454..1bbe5a81968 100644 --- a/addons/stock_account/wizard/stock_valuation_history.py +++ b/addons/stock_account/wizard/stock_valuation_history.py @@ -155,8 +155,7 @@ class stock_history(osv.osv): product_template ON product_template.id = product_product.product_tmpl_id WHERE quant.qty>0 AND stock_move.state = 'done' AND dest_location.usage in ('internal', 'transit') AND ( - (source_location.company_id is null and dest_location.company_id is not null) or - (source_location.company_id is not null and dest_location.company_id is null) or + not (source_location.company_id is 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 ALL @@ -187,8 +186,7 @@ class stock_history(osv.osv): product_template ON product_template.id = product_product.product_tmpl_id WHERE quant.qty>0 AND stock_move.state = 'done' AND source_location.usage in ('internal', 'transit') AND ( - (dest_location.company_id is null and source_location.company_id is not null) or - (dest_location.company_id is not null and source_location.company_id is null) or + not (dest_location.company_id is null and source_location.company_id is null) or dest_location.company_id != source_location.company_id or dest_location.usage not in ('internal', 'transit')) ))