From 19ea613bce6bf27ab8f1edf6430aeb7aaedc3d9f Mon Sep 17 00:00:00 2001 From: Antoine <> Date: Mon, 30 Apr 2012 16:50:02 +0530 Subject: [PATCH] [FIX] stock :Fixes the searching problem in Inventory analysis lp bug: https://launchpad.net/bugs/985635 fixed bzr revid: amb@tinyerp.com-20120430112002-7qitbk228qodsnwy --- addons/stock/report/report_stock_move.py | 9 +++++---- addons/stock/report/report_stock_move_view.xml | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/stock/report/report_stock_move.py b/addons/stock/report/report_stock_move.py index da6be7873c3..9915c30f132 100644 --- a/addons/stock/report/report_stock_move.py +++ b/addons/stock/report/report_stock_move.py @@ -166,6 +166,7 @@ class report_stock_inventory(osv.osv): help='When the stock move is created it is in the \'Draft\' state.\n After that it is set to \'Confirmed\' state.\n If stock is available state is set to \'Avaiable\'.\n When the picking it done the state is \'Done\'.\ \nThe state is \'Waiting\' if the move is waiting for another one.'), 'location_type': fields.selection([('supplier', 'Supplier Location'), ('view', 'View'), ('internal', 'Internal Location'), ('customer', 'Customer Location'), ('inventory', 'Inventory'), ('procurement', 'Procurement'), ('production', 'Production'), ('transit', 'Transit Location for Inter-Companies Transfers')], 'Location Type', required=True), + 'scrap_location': fields.boolean('scrap'), } def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_inventory') @@ -174,7 +175,7 @@ CREATE OR REPLACE view report_stock_inventory AS ( (SELECT min(m.id) as id, m.date as date, m.partner_id as partner_id, m.location_id as location_id, - m.product_id as product_id, pt.categ_id as product_categ_id, l.usage as location_type, + m.product_id as product_id, pt.categ_id as product_categ_id, l.usage as location_type, l.scrap_location as scrap_location, m.company_id, m.state as state, m.prodlot_id as prodlot_id, @@ -191,12 +192,12 @@ CREATE OR REPLACE view report_stock_inventory AS ( LEFT JOIN stock_location l ON (m.location_id=l.id) GROUP BY m.id, m.product_id, m.product_uom, pt.categ_id, m.partner_id, m.location_id, m.location_dest_id, - m.prodlot_id, m.date, m.state, l.usage, m.company_id, pt.uom_id + m.prodlot_id, m.date, m.state, l.usage, l.scrap_location, m.company_id, pt.uom_id ) UNION ALL ( SELECT -m.id as id, m.date as date, m.partner_id as partner_id, m.location_dest_id as location_id, - m.product_id as product_id, pt.categ_id as product_categ_id, l.usage as location_type, + m.product_id as product_id, pt.categ_id as product_categ_id, l.usage as location_type, l.scrap_location as scrap_location, m.company_id, m.state as state, m.prodlot_id as prodlot_id, coalesce(sum(pt.standard_price * m.product_qty * pu.factor / pu2.factor)::decimal, 0.0) as value, @@ -212,7 +213,7 @@ CREATE OR REPLACE view report_stock_inventory AS ( LEFT JOIN stock_location l ON (m.location_dest_id=l.id) GROUP BY m.id, m.product_id, m.product_uom, pt.categ_id, m.partner_id, m.location_id, m.location_dest_id, - m.prodlot_id, m.date, m.state, l.usage, m.company_id, pt.uom_id + m.prodlot_id, m.date, m.state, l.usage, l.scrap_location, m.company_id, pt.uom_id ) ); """) diff --git a/addons/stock/report/report_stock_move_view.xml b/addons/stock/report/report_stock_move_view.xml index 01ef4a70289..5118ac78bb4 100644 --- a/addons/stock/report/report_stock_move_view.xml +++ b/addons/stock/report/report_stock_move_view.xml @@ -231,7 +231,7 @@ - +