[IMP]: Imprve claim SQL view report.
bzr revid: rch_open_erp-20100423133026-n523c4ni0wyzkods
This commit is contained in:
parent
0b4c41d6fe
commit
ec57897716
|
@ -21,6 +21,7 @@
|
|||
|
||||
from osv import fields,osv
|
||||
import tools
|
||||
import crm_report
|
||||
|
||||
|
||||
class crm_claim_report(osv.osv):
|
||||
|
@ -41,6 +42,10 @@ class crm_claim_report(osv.osv):
|
|||
('object_id.model', '=', 'crm.claim')]", 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', 'Claim Type',\
|
||||
domain="[('section_id','=',section_id),\
|
||||
('object_id.model', '=', 'crm.claim')]"),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
|
@ -68,6 +73,8 @@ class crm_claim_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,
|
||||
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
|
||||
|
@ -75,6 +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
|
||||
)""")
|
||||
|
||||
crm_claim_report()
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
<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"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -73,6 +75,9 @@
|
|||
<separator orientation="vertical"/>
|
||||
<field name="stage_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]"/>
|
||||
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="priority" />
|
||||
<field name="type_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]"/>
|
||||
</group>
|
||||
</xpath>
|
||||
<xpath
|
||||
|
@ -81,6 +86,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>
|
||||
|
|
|
@ -29,6 +29,13 @@ AVAILABLE_STATES = [
|
|||
('done', 'Closed'),
|
||||
('pending','Pending')
|
||||
]
|
||||
AVAILABLE_PRIORITIES = [
|
||||
('5', 'Lowest'),
|
||||
('4', 'Low'),
|
||||
('3', 'Normal'),
|
||||
('2', 'High'),
|
||||
('1', 'Highest')
|
||||
]
|
||||
|
||||
class crm_case_report(osv.osv):
|
||||
""" Cases and section """
|
||||
|
|
Loading…
Reference in New Issue