[IMP]: Improve SQL view report of claim,lead and fundraising.
bzr revid: rch_open_erp-20100426100140-n0ppf5ddggbungbs
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
<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="canal_id" invisible="1"/>
|
||||
<field name="som" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -78,6 +81,11 @@
|
||||
<separator orientation="vertical"/>
|
||||
<field name="priority" />
|
||||
<field name="type_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="canal_id" widget="selection" />
|
||||
<field name="som" widget="selection" />
|
||||
<newline/>
|
||||
<field name="date_closed" />
|
||||
</group>
|
||||
</xpath>
|
||||
<xpath
|
||||
@@ -94,6 +102,11 @@
|
||||
context="{'group_by':'priority'}" />
|
||||
<filter string="Type" icon="terp-sale" domain="[]"
|
||||
context="{'group_by':'type_id'}" />
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Channel" icon="terp-sale" domain="[]"
|
||||
context="{'group_by':'canal_id'}" />
|
||||
<filter string="State of Mind" icon="terp-sale" domain="[]"
|
||||
context="{'group_by':'som'}" />
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
<field name="day" invisible="1"/>
|
||||
<field name="priority" invisible="1"/>
|
||||
<field name="date_closed" invisible="1"/>
|
||||
<field name="canal_id" invisible="1"/>
|
||||
<field name="som" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
@@ -77,7 +79,10 @@
|
||||
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.fundraising')]"/>
|
||||
<field name="priority"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="date_closed"/>
|
||||
<field name="canal_id" widget="selection" />
|
||||
<field name="som" widget="selection" />
|
||||
<newline/>
|
||||
<field name="date_closed" />
|
||||
</group>
|
||||
</xpath>
|
||||
<xpath
|
||||
@@ -85,6 +90,11 @@
|
||||
position='after'>
|
||||
<filter string="Priority" icon="terp-sale" domain="[]"
|
||||
context="{'group_by':'priority'}" />
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Channel" icon="terp-sale" domain="[]"
|
||||
context="{'group_by':'canal_id'}" />
|
||||
<filter string="State of Mind" icon="terp-sale" domain="[]"
|
||||
context="{'group_by':'som'}" />
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user