Skip to content
Snippets Groups Projects
Commit 3d6a575d authored by Géry Debongnie's avatar Géry Debongnie
Browse files

[IMP] changes the crm_lead graph view in reporting, to use the new groupby...

[IMP] changes the crm_lead graph view in reporting, to use the new groupby interval features of graph view (addon crm)

bzr revid: ged@openerp.com-20140124122439-t8vvgy9zebbhhy2a
parent 48452212
No related branches found
No related tags found
No related merge requests found
......@@ -43,21 +43,11 @@ class crm_lead_report(osv.osv):
_name = "crm.lead.report"
_auto = False
_description = "CRM Lead Analysis"
_rec_name = 'deadline_day'
_rec_name = 'date_deadline'
_columns = {
# grouping fields based on Deadline Date
'deadline_year': fields.char('Ex. Closing Year', size=10, readonly=True, help="Expected closing year"),
'deadline_month':fields.selection(MONTHS, 'Exp. Closing Month', readonly=True, help="Expected closing month"),
'deadline_day': fields.char('Exp. Closing Day', size=10, readonly=True, help="Expected closing day"),
# grouping fields based on Create Date
'creation_year': fields.char('Creation Year', size=10, readonly=True, help="Creation year"),
'creation_month': fields.selection(MONTHS, 'Creation Month', readonly=True, help="Creation month"),
'creation_day': fields.char('Creation Day', size=10, readonly=True, help="Creation day"),
# other date fields
'create_date': fields.datetime('Create Date', readonly=True),
'date_deadline': fields.date('Exp. Closing', size=10, readonly=True, help="Expected Closing"),
'create_date': fields.datetime('Creation Date', readonly=True),
'opening_date': fields.date('Assignation Date', readonly=True),
'date_closed': fields.date('Close Date', readonly=True),
'date_last_stage_update': fields.datetime('Last Stage Update', readonly=True),
......@@ -78,7 +68,6 @@ class crm_lead_report(osv.osv):
'probable_revenue': fields.float('Probable Revenue', digits=(16,2),readonly=True),
'stage_id': fields.many2one ('crm.case.stage', 'Stage', readonly=True, domain="[('section_ids', '=', section_id)]"),
'partner_id': fields.many2one('res.partner', 'Partner' , readonly=True),
'nbr': fields.integer('# of Cases', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
'type':fields.selection([
......@@ -98,9 +87,7 @@ class crm_lead_report(osv.osv):
CREATE OR REPLACE VIEW crm_lead_report AS (
SELECT
id,
to_char(c.date_deadline, 'YYYY') as deadline_year,
to_char(c.date_deadline, 'MM') as deadline_month,
to_char(c.date_deadline, 'YYYY-MM-DD') as deadline_day,
c.date_deadline,
to_char(c.create_date, 'YYYY') as creation_year,
to_char(c.create_date, 'MM') as creation_month,
......@@ -124,7 +111,6 @@ class crm_lead_report(osv.osv):
c.country_id,
c.planned_revenue,
c.planned_revenue*(c.probability/100) as probable_revenue,
1 as nbr,
date_trunc('day',c.create_date) as create_date,
extract('epoch' from (c.date_closed-c.create_date))/(3600*24) as delay_close,
abs(extract('epoch' from (c.date_deadline - c.date_closed))/(3600*24)) as delay_expected,
......
......@@ -10,8 +10,7 @@
<field name="arch" type="xml">
<graph string="Leads Analysis" type="pivot" stacked="True">
<field name="user_id" type="row"/>
<field name="creation_month" type="row"/>
<field name="nbr" type="measure"/>
<field name="create_date" interval="week" type="col"/>
</graph>
</field>
</record>
......@@ -21,9 +20,10 @@
<field name="model">crm.lead.report</field>
<field name="arch" type="xml">
<graph string="Leads Analysis" type="pivot" stacked="True">
<field name="user_id" type="row"/>
<field name="creation_month" type="row"/>
<field name="planned_revenue" type="measure"/>
<field name="date_deadline" type="row"/>
<field name="user_id" type="col"/>
<field name="stage_id" type="col"/>
<field name="probable_revenue" type="measure"/>
</graph>
</field>
</record>
......@@ -67,27 +67,29 @@
<field name="date_closed"/>
</group>
<group expand="1" string="Group By...">
<filter string="Salesperson" name="user" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}" />
<filter string="Salesperson" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}" />
<filter string="Sales Team" icon="terp-personal+" domain="[]" context="{'group_by':'section_id'}" />
<filter string="Partner" icon="terp-partner" context="{'group_by':'partner_id'}" />
<filter string="Country" icon="terp-go-home" context="{'group_by':'country_id'}" />
<filter string="Company" icon="terp-go-home" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Stage" name="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}"/>
<filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}"/>
<filter string="Priority" icon="terp-rating-rated" domain="[]" context="{'group_by':'priority'}" />
<filter string="Campaign" icon="terp-gtk-jump-to-rtl"
domain="[]" context="{'group_by':'type_id'}" />
<filter string="Channel" icon="terp-call-start"
domain="[]" context="{'group_by':'channel_id'}" />
<separator orientation="vertical" />
<filter string="Year" icon="terp-go-year"
domain="[]" context="{'group_by':'creation_year'}"/>
<filter string="Month" name="month" icon="terp-go-month"
domain="[]" context="{'group_by':'creation_month'}"/>
<filter string="Day" icon="terp-go-today"
domain="[]" context="{'group_by':'creation_day'}"/>
<filter string="Creation date (day)" icon="terp-go-year"
domain="[]" context="{'group_by':'create_date:day'}"/>
<filter string="Creation date (week)" icon="terp-go-year"
domain="[]" context="{'group_by':'create_date:week'}"/>
<filter string="Creation date (month)" icon="terp-go-year"
domain="[]" context="{'group_by':'create_date:month'}"/>
<filter string="Creation date (year)" icon="terp-go-year"
domain="[]" context="{'group_by':'create_date:year'}"/>
<separator orientation="vertical" />
<filter string="Exp. Closing" icon="terp-go-month"
domain="[]" context="{'group_by':'deadline_month'}"/>
domain="[]" context="{'group_by':'date_deadline'}"/>
<filter string="Last Stage Update" context="{'group_by':'date_last_stage_update'}" />
</group>
</search>
......@@ -100,7 +102,6 @@
<field name="name">Leads Analysis</field>
<field name="res_model">crm.lead.report</field>
<field name="view_type">form</field>
<field name="context">{'search_default_year': 1, "search_default_user":1, "search_default_month":1, 'group_by_no_leaf':1, 'group_by':[]}</field>
<field name="view_mode">graph</field>
<field name="domain">[('type','=', 'lead')]</field>
<field name="help">Leads Analysis allows you to check different CRM related information like the treatment delays or number of leads per state. You can sort out your leads analysis by different groups to get accurate grained analysis.</field>
......@@ -116,7 +117,6 @@
<field name="name">Opportunities Analysis</field>
<field name="res_model">crm.lead.report</field>
<field name="view_type">form</field>
<field name="context">{"search_default_year":1, "search_default_user":1,"search_default_month":1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="view_mode">graph</field>
<field name="domain">[('type','=', 'opportunity')]</field>
<field name="help">Opportunities Analysis gives you an instant access to your opportunities with information such as the expected revenue, planned cost, missed deadlines or the number of interactions per opportunity. This report is mainly used by the sales manager in order to do the periodic review with the teams of the sales pipeline.</field>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment