[IMP]: Improve SQL view report for crm.lead.
bzr revid: rch_open_erp-20100426063812-6e8ldx12o32cdosy
This commit is contained in:
parent
2ced640a01
commit
bf266e764a
|
@ -82,7 +82,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.som
|
||||
,c.priority,c.type_id
|
||||
)""")
|
||||
|
||||
crm_claim_report()
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
from osv import fields,osv
|
||||
import tools
|
||||
import crm_report
|
||||
|
||||
AVAILABLE_STATES = [
|
||||
('draft','Draft'),
|
||||
|
@ -47,6 +48,12 @@ class crm_lead_report(osv.osv):
|
|||
('object_id.model', '=', 'crm.lead')]", readonly=True),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner' , readonly=True),
|
||||
'company_id': fields.many2one('res.company', 'Company', readonly=True),
|
||||
'priority': fields.selection(crm_report.AVAILABLE_PRIORITIES, 'Priority'),
|
||||
'type_id': fields.many2one('crm.case.resource.type', 'Lead Type', \
|
||||
domain="[('section_id','=',section_id),\
|
||||
('object_id.model', '=', 'crm.lead')]"),
|
||||
'date_closed': fields.datetime('Closed', readonly=True),
|
||||
'date_open': fields.datetime('Opened', readonly=True),
|
||||
}
|
||||
def init(self, cr):
|
||||
|
||||
|
@ -74,6 +81,10 @@ class crm_lead_report(osv.osv):
|
|||
0 as avg_answers,
|
||||
0.0 as perc_done,
|
||||
0.0 as perc_cancel,
|
||||
c.priority as priority,
|
||||
c.type_id as type_id,
|
||||
c.date_closed as date_closed,
|
||||
c.date_open as date_open,
|
||||
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
|
||||
|
@ -81,6 +92,7 @@ class crm_lead_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,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.date_closed,c.date_open
|
||||
)""")
|
||||
|
||||
crm_lead_report()
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
<field name="state" invisible="1"/>
|
||||
<field name="stage_id" invisible="1"/>
|
||||
<field name="categ_id" invisible="1"/>
|
||||
<field name="priority" invisible="1"/>
|
||||
<field name="type_id" invisible="1"/>
|
||||
<field name="date_closed" invisible="1"/>
|
||||
<field name="date_open" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -70,6 +74,12 @@
|
|||
<separator orientation="vertical"/>
|
||||
<field name="stage_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]"/>
|
||||
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="priority" />
|
||||
<field name="type_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]"/>
|
||||
<newline/>
|
||||
<field name="date_closed" />
|
||||
<field name="date_open" />
|
||||
</group>
|
||||
</xpath>
|
||||
<xpath
|
||||
|
@ -78,6 +88,15 @@
|
|||
<filter string="Stage" icon="terp-sale" domain="[]"
|
||||
context="{'group_by':'stage_id'}" />
|
||||
</xpath>
|
||||
<xpath
|
||||
expr='//search[@string="Search"]/group[@string="Group By..."]/filter[@string="Category"]'
|
||||
position='after'>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Priority" icon="terp-sale" domain="[]"
|
||||
context="{'group_by':'priority'}" />
|
||||
<filter string="Type" icon="terp-sale" domain="[]"
|
||||
context="{'group_by':'type_id'}" />
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -106,9 +106,10 @@
|
|||
help="My company"/>
|
||||
</field>
|
||||
|
||||
<field name="user_id" select="1" widget="selection">
|
||||
<filter icon="terp-crm" string="My Case" help="My Case" domain="[('user_id','=',uid)]" />
|
||||
</field>
|
||||
<field name="user_id" widget="selection">
|
||||
<filter icon="terp-partner" domain="[('user_id','=',uid)]" help="My Case" />
|
||||
<filter icon="terp-partner" domain="[('user_id','=', False)]" help="Unassigned Case"/>
|
||||
</field>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." colspan="10" col="12">
|
||||
|
|
Loading…
Reference in New Issue