From 68ac3e6fa806ea369d0118425f6e53e0c83df36c Mon Sep 17 00:00:00 2001 From: "rch (Open ERP)" <> Date: Mon, 26 Apr 2010 15:31:40 +0530 Subject: [PATCH] [IMP]: Improve SQL view report of claim,lead and fundraising. bzr revid: rch_open_erp-20100426100140-n0ppf5ddggbungbs --- addons/crm/report/crm_claim_report.py | 8 +++++++- addons/crm/report/crm_claim_report_view.xml | 13 +++++++++++++ addons/crm/report/crm_fundraising_report.py | 7 ++++++- addons/crm/report/crm_fundraising_report_view.xml | 12 +++++++++++- 4 files changed, 37 insertions(+), 3 deletions(-) diff --git a/addons/crm/report/crm_claim_report.py b/addons/crm/report/crm_claim_report.py index 70d6be8d616..74b95864759 100644 --- a/addons/crm/report/crm_claim_report.py +++ b/addons/crm/report/crm_claim_report.py @@ -46,6 +46,9 @@ class crm_claim_report(osv.osv): 'type_id': fields.many2one('crm.case.resource.type', 'Claim Type',\ domain="[('section_id','=',section_id),\ ('object_id.model', '=', 'crm.claim')]"), + 'date_closed': fields.datetime('Closed', readonly=True), + 'canal_id': fields.many2one('res.partner.canal','Channel',domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.claim')]"), + 'som': fields.many2one('res.partner.som', 'State of Mind') } def init(self, cr): @@ -75,6 +78,9 @@ class crm_claim_report(osv.osv): 0.0 as perc_cancel, c.priority as priority, c.type_id as type_id, + c.date_closed as date_closed, + c.canal_id as canal_id, + c.som as som, date_trunc('day',c.create_date) as create_date, avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close from @@ -82,7 +88,7 @@ class crm_claim_report(osv.osv): group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'), \ c.state, c.user_id,c.section_id, c.stage_id,\ c.categ_id,c.partner_id,c.company_id,c.create_date,to_char(c.create_date, 'YYYY-MM-DD') - ,c.priority,c.type_id + ,c.priority,c.type_id,c.date_closed,c.canal_id,c.som )""") crm_claim_report() diff --git a/addons/crm/report/crm_claim_report_view.xml b/addons/crm/report/crm_claim_report_view.xml index 647a0125179..74ebbd56d0b 100644 --- a/addons/crm/report/crm_claim_report_view.xml +++ b/addons/crm/report/crm_claim_report_view.xml @@ -24,6 +24,9 @@ + + + @@ -78,6 +81,11 @@ + + + + + + + + diff --git a/addons/crm/report/crm_fundraising_report.py b/addons/crm/report/crm_fundraising_report.py index 2b3fbcb4c7a..5765b7367b0 100644 --- a/addons/crm/report/crm_fundraising_report.py +++ b/addons/crm/report/crm_fundraising_report.py @@ -42,7 +42,9 @@ class crm_fundraising_report(osv.osv): 'partner_id': fields.many2one('res.partner', 'Partner'), 'company_id': fields.many2one('res.company', 'Company'), 'priority': fields.selection(crm_report.AVAILABLE_PRIORITIES, 'Priority'), - 'date_closed': fields.datetime('Closed', readonly=True) + 'date_closed': fields.datetime('Closed', readonly=True), + 'canal_id': fields.many2one('res.partner.canal','Channel',domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.fundraising')]"), + 'som': fields.many2one('res.partner.som', 'State of Mind') } def init(self, cr): @@ -71,6 +73,8 @@ class crm_fundraising_report(osv.osv): 0.0 as perc_cancel, c.priority as priority, c.date_closed as date_closed, + c.canal_id as canal_id, + c.som as som, date_trunc('day',c.create_date) as create_date, sum(planned_revenue) as amount_revenue, sum(planned_revenue*probability)::decimal(16,2) as amount_revenue_prob, @@ -81,6 +85,7 @@ class crm_fundraising_report(osv.osv): 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'),c.priority,c.date_closed + ,c.canal_id,c.som )""") crm_fundraising_report() diff --git a/addons/crm/report/crm_fundraising_report_view.xml b/addons/crm/report/crm_fundraising_report_view.xml index 1d97b868a34..7236df4a8b4 100644 --- a/addons/crm/report/crm_fundraising_report_view.xml +++ b/addons/crm/report/crm_fundraising_report_view.xml @@ -26,6 +26,8 @@ + + @@ -77,7 +79,10 @@ - + + + + + + +