From 4cf2887153ef187fd5de74bbbdd68789c8b55a7e Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 5 Nov 2013 11:19:30 +0100 Subject: [PATCH] [FIX] purchase: analysis view must not group by quantity, otherwise identical PO lines are counted only once The product quantity is one of the columns that must be aggregated, not used to fold PO lines into the same result row. This, combined with missing aggregation operators was causing multiple identical PO lines from the same PO to be merged together and only counted once in some aggregations. bzr revid: odo@openerp.com-20131105101930-f2qbcp12luom08je --- addons/purchase/report/purchase_report.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/purchase/report/purchase_report.py b/addons/purchase/report/purchase_report.py index c4c9c641710..c999b542f00 100644 --- a/addons/purchase/report/purchase_report.py +++ b/addons/purchase/report/purchase_report.py @@ -94,7 +94,7 @@ class purchase_report(osv.osv): extract(epoch from age(s.date_approve,s.date_order))/(24*60*60)::decimal(16,2) as delay, extract(epoch from age(l.date_planned,s.date_order))/(24*60*60)::decimal(16,2) as delay_pass, count(*) as nbr, - (l.price_unit*l.product_qty)::decimal(16,2) as price_total, + sum(l.price_unit*l.product_qty)::decimal(16,2) as price_total, avg(100.0 * (l.price_unit*l.product_qty) / NULLIF(t.standard_price*l.product_qty/u.factor*u2.factor, 0.0))::decimal(16,2) as negociation, sum(t.standard_price*l.product_qty/u.factor*u2.factor)::decimal(16,2) as price_standard, (sum(l.product_qty*l.price_unit)/NULLIF(sum(l.product_qty/u.factor*u2.factor),0.0))::decimal(16,2) as price_average @@ -108,7 +108,6 @@ class purchase_report(osv.osv): s.company_id, s.create_uid, s.partner_id, - l.product_qty, u.factor, s.location_id, l.price_unit,