[IMP] lead report views
bzr revid: nel@tinyerp.com-20100605161749-vx0meubea86bqtq7
This commit is contained in:
parent
958cf4bbbe
commit
2743b46cac
|
@ -91,7 +91,7 @@ class crm_lead_report(osv.osv):
|
|||
'create_date': fields.datetime('Create Date', readonly=True),
|
||||
'day': fields.char('Day', size=128, readonly=True),
|
||||
'email': fields.integer('# of Emails', size=128, readonly=True),
|
||||
'expected_closing_days': fields.integer('# of Expected Closing Days', size=128, readonly=True),
|
||||
'expected_closing_days': fields.integer('Avg Expected Closing Days', size=128, readonly=True),
|
||||
'delay_open': fields.float('Delay to open',digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to open the case"),
|
||||
'delay_close': fields.float('Delay to close',digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to close the case"),
|
||||
'categ_id': fields.many2one('crm.case.categ', 'Category',\
|
||||
|
@ -130,17 +130,18 @@ class crm_lead_report(osv.osv):
|
|||
c.section_id,
|
||||
c.categ_id,
|
||||
c.partner_id,
|
||||
count(*) as nbr,
|
||||
(select 1) as nbr,
|
||||
0 as avg_answers,
|
||||
0.0 as perc_done,
|
||||
0.0 as perc_cancel,
|
||||
(select count(id) from mailgate_message where thread_id=c.id) as email,
|
||||
date_trunc('day',c.create_date) as create_date,
|
||||
sum(cast(to_char(date_trunc('day',c.date_open) - date_trunc('day',c.date_deadline),'DD') as int)) as expected_closing_days,
|
||||
avg(cast(to_char(date_trunc('day',c.date_open) - date_trunc('day',c.date_deadline),'DD') as int)) as expected_closing_days,
|
||||
avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close,
|
||||
avg(extract('epoch' from (c.date_open-c.create_date)))/(3600*24) as delay_open
|
||||
from
|
||||
crm_lead c
|
||||
where c.type='lead' or c.type is null
|
||||
group by
|
||||
to_char(c.create_date, 'YYYY'),
|
||||
to_char(c.create_date, 'MM'),
|
||||
|
|
|
@ -10,19 +10,22 @@
|
|||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Leads Analysis">
|
||||
<field name="name" invisible="1"/>
|
||||
<field name="month" invisible="1"/>
|
||||
<field name="section_id" invisible="1"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="partner_id" invisible="1"/>
|
||||
<field name="day" invisible="1"/>
|
||||
<field name="nbr" string="#Leads" sum="#Leads" attrs="{'string': 'type'=='opportunity' and '#opp' or '#lead'}"/>
|
||||
<field name="delay_close" sum='Avg Closing Delay'/>
|
||||
<field name="name" invisible="1"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="stage_id" invisible="1"/>
|
||||
<field name="categ_id" invisible="1"/>
|
||||
<field name="type" invisible="1"/>
|
||||
<field name="month" invisible="1"/>
|
||||
<field name="section_id" invisible="1"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="partner_id" invisible="1"/>
|
||||
<field name="day" invisible="1"/>
|
||||
<field name="nbr" sum="# Leads"/>
|
||||
<field name="email" sum="#Mails"/>
|
||||
<field name="delay_open" sum='Avg Closing Delay'/>
|
||||
<field name="delay_close" sum='Avg Closing Delay'/>
|
||||
<field name="expected_closing_days" sum='#Expected Closing'/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -79,11 +82,8 @@
|
|||
domain="[('create_date','<=', time.strftime('%%Y-%%m-%%d')), ('create_date','>',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"/>
|
||||
<separator orientation="vertical" />
|
||||
<filter icon="terp-crm"
|
||||
string="Draft"
|
||||
domain="[('state','=','draft')]"/>
|
||||
<filter icon="terp-crm"
|
||||
string="Open"
|
||||
domain="[('state','=','open')]"/>
|
||||
string="Current"
|
||||
domain="[('state','in',('draft','open')]"/>
|
||||
<filter icon="terp-crm"
|
||||
string="Pending"
|
||||
domain="[('state','=','pending')]"/>
|
||||
|
@ -105,19 +105,20 @@
|
|||
<group expand="1" string="Group By...">
|
||||
<filter string="User" name="User" icon="terp-crm"
|
||||
domain="[]" context="{'group_by':'user_id'}" />
|
||||
<filter string="Company" icon="terp-crm"
|
||||
domain="[]"
|
||||
context="{'group_by':'company_id'}" />
|
||||
<filter string="Section" icon="terp-crm"
|
||||
domain="[]"
|
||||
context="{'group_by':'section_id'}" />
|
||||
<separator orientation="vertical" />
|
||||
<filter string="State" icon="terp-crm"
|
||||
domain="[]" context="{'group_by':'state'}" />
|
||||
<filter string="Stage" icon="terp-crm" domain="[]"
|
||||
context="{'group_by':'stage_id'}" />
|
||||
<filter string="Stage" icon="terp-crm" domain="[]"
|
||||
context="{'group_by':'stage_id'}" />
|
||||
<filter string="Category" icon="terp-crm"
|
||||
domain="[]" context="{'group_by':'categ_id'}" />
|
||||
<filter string="Partner" icon="terp-personal"
|
||||
domain="[]" context="{'group_by':'partner_id'}" />
|
||||
<separator orientation="vertical" />
|
||||
<filter string="Company" icon="terp-crm"
|
||||
domain="[]"
|
||||
context="{'group_by':'company_id'}" />
|
||||
<separator orientation="vertical" />
|
||||
<filter string="Day" icon="terp-crm"
|
||||
domain="[]" context="{'group_by':'day'}"/>
|
||||
|
@ -129,6 +130,7 @@
|
|||
<newline/>
|
||||
<group expand="0" string="Extended options..." groups="base.group_extended">
|
||||
<field name="state"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="stage_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]"/>
|
||||
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]"/>
|
||||
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||
|
@ -144,23 +146,24 @@
|
|||
<field name="model">crm.lead.report</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Opportunities Analysis">
|
||||
<field name="name" invisible="1"/>
|
||||
<field name="month" invisible="1"/>
|
||||
<field name="section_id" invisible="1" groups="base.group_extended"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="company_id" invisible="1" groups="base.group_extended"/>
|
||||
<field name="partner_id" invisible="1"/>
|
||||
<field name="day" invisible="1"/>
|
||||
<field name="nbr" string="#Opportunities" sum="#Opportunities"/>
|
||||
<field name="email" sum="# of Emails"/>
|
||||
<field name="expected_closing_days" sum='# of Expected Closing Days'/>
|
||||
<field name="delay_open" sum='Delay to open'/>
|
||||
<field name="delay_close" sum='Delay to close'/>
|
||||
<tree string="Leads Analysis">
|
||||
<field name="name" invisible="1"/>
|
||||
<field name="month" invisible="1"/>
|
||||
<field name="section_id" invisible="1" groups="base.group_extended"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="partner_id" invisible="1"/>
|
||||
<field name="day" invisible="1"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="stage_id" invisible="1"/>
|
||||
<field name="categ_id" invisible="1"/>
|
||||
<field name="type" invisible="1"/>
|
||||
<field name="partner_id" invisible="1"/>
|
||||
<field name="nbr" string="#Opportunities" sum="#Opportunities"/>
|
||||
<field name="email" sum="# of Emails"/>
|
||||
<field name="company_id" invisible="1" groups="base.group_multi_company"/>
|
||||
<field name="expected_closing_days" sum='# of Expected Closing Days'/>
|
||||
<field name="delay_open" sum='Delay to open'/>
|
||||
<field name="delay_close" sum='Delay to close'/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
|
Loading…
Reference in New Issue