From 370ec5aac491eeefd8a39f31eedb87ce3fe72e40 Mon Sep 17 00:00:00 2001 From: mtr Date: Mon, 20 Sep 2010 19:29:10 +0530 Subject: [PATCH] [IMP] crm_fundraising:-useability improvements as defined on etherpad bzr revid: mtr@mtr-20100920135910-1lcgn6fb87ze59ev --- .../report/crm_fundraising_report.py | 18 ++++-- .../report/crm_fundraising_report_view.xml | 55 +++++++++++-------- 2 files changed, 44 insertions(+), 29 deletions(-) diff --git a/addons/crm_fundraising/report/crm_fundraising_report.py b/addons/crm_fundraising/report/crm_fundraising_report.py index 8ab9e0f94be..81c2b70c2d6 100644 --- a/addons/crm_fundraising/report/crm_fundraising_report.py +++ b/addons/crm_fundraising/report/crm_fundraising_report.py @@ -61,6 +61,10 @@ class crm_fundraising_report(osv.osv): 'delay_close': fields.float('Delay to close', digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to close the case"), 'partner_id': fields.many2one('res.partner', 'Partner'), 'company_id': fields.many2one('res.company', 'Company'), + 'type_id': fields.many2one('crm.case.resource.type', 'Fundraising Type', \ + domain="[('section_id','=',section_id),\ + ('object_id.model', '=', 'crm.fundraising')]"), + 'planned_cost': fields.float('Planned Costs',readonly=True,digits=(16,2)), } def init(self, cr): @@ -74,26 +78,28 @@ class crm_fundraising_report(osv.osv): create or replace view crm_fundraising_report as ( select min(c.id) as id, - to_char(c.create_date, 'YYYY') as name, - to_char(c.create_date, 'MM') as month, - to_char(c.create_date, 'YYYY-MM-DD') as day, + to_char(c.date, 'YYYY') as name, + to_char(c.date, 'MM') as month, + to_char(c.date, 'YYYY-MM-DD') as day, c.state, c.user_id, c.section_id, c.categ_id, + c.type_id, c.company_id, c.partner_id, count(*) as nbr, date_trunc('day',c.create_date) as create_date, sum(planned_revenue) as amount_revenue, + sum(planned_cost) as planned_cost, sum(planned_revenue*probability)::decimal(16,2) as amount_revenue_prob, avg(probability)::decimal(16,2) as probability, avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close from crm_fundraising c - group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'),\ - c.state, c.user_id,c.section_id,c.categ_id,c.partner_id,c.company_id, - c.create_date,to_char(c.create_date, 'YYYY-MM-DD') + group by to_char(c.date, 'YYYY'), to_char(c.date, 'MM'),\ + c.state, c.user_id,c.section_id,c.categ_id,type_id,c.partner_id,c.company_id, + c.create_date,to_char(c.date, 'YYYY-MM-DD') )""") crm_fundraising_report() diff --git a/addons/crm_fundraising/report/crm_fundraising_report_view.xml b/addons/crm_fundraising/report/crm_fundraising_report_view.xml index 8e9f1611af6..15f06706bed 100644 --- a/addons/crm_fundraising/report/crm_fundraising_report_view.xml +++ b/addons/crm_fundraising/report/crm_fundraising_report_view.xml @@ -9,7 +9,7 @@ crm.fundraising.report tree - + @@ -17,6 +17,7 @@ + @@ -24,6 +25,7 @@ + @@ -74,14 +76,17 @@ - + - + - + - + - + - - - - - - - + + + + + domain="[]" context="{'group_by':'day'}" + help="Day on which fund is raised"/> + domain="[]" context="{'group_by':'month'}" + help="Month in which fund is raised"/> + domain="[]" context="{'group_by':'name'}" + help="Year in which fund is raised"/> @@ -170,7 +179,7 @@ - Fundraising + Fundraising Analysis crm.fundraising.report form tree,graph