[IMP]report_crm: add the section_id in report

bzr revid: sbh@tinyerp.com-20100120060025-31u6329nga610pix
This commit is contained in:
sbh (Open ERP)
2010-01-20 11:30:25 +05:30
parent f832890f01
commit d07efd8215
2 changed files with 13 additions and 4 deletions
+6 -4
View File
@@ -69,6 +69,7 @@ class report_crm_case_categ(osv.osv):
_auto = False
_columns = {
'name': fields.char('Year',size=64,required=False, readonly=True),
'section_id':fields.many2one('crm.case.section', 'Section', readonly=True),
'nbr': fields.integer('# of Cases', readonly=True),
'state': fields.selection(AVAILABLE_STATES, 'Status', size=16, readonly=True),
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'),
@@ -84,10 +85,11 @@ class report_crm_case_categ(osv.osv):
to_char(c.create_date, 'YYYY') as name,
to_char(c.create_date, 'MM') as month,
c.state,
c.section_id,
count(*) as nbr
from
crm_case c
group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'), c.state
group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'), c.state,c.section_id
)""")
report_crm_case_categ()
@@ -122,6 +124,7 @@ class report_crm_case_section(osv.osv):
_columns = {
'name': fields.char('Year',size=64,required=False, readonly=True),
# 'user_id':fields.many2one('res.users', 'User', readonly=True),
'section_id':fields.many2one('crm.case.section', 'Section', readonly=True),
'nbr_cases': fields.integer('# of Cases', readonly=True),
'avg_answers': fields.function(_get_data,string='Avg. Answers', method=True,type="integer"),
# 'perc_done': fields.function(_get_data,string='%Done', method=True,type="float"),
@@ -139,9 +142,8 @@ class report_crm_case_section(osv.osv):
to_char(c.create_date, 'YYYY') as name,
to_char(c.create_date, 'MM') as month,
count(*) as nbr_cases,
0 as avg_answers,
0.0 as perc_done,
0.0 as perc_cancel
c.section_id as section_id,
0 as avg_answers
from
crm_case c
group by to_char(c.create_date, 'YYYY'),to_char(c.create_date, 'MM'),c.section_id
+7
View File
@@ -30,6 +30,7 @@
<field name="name" select="1"/>
<field name="month" select="1"/>
<field name="user_id" select="1"/>
<field name="section_id" select="1"/>
<field name="nbr" select="1"/>
<field name="state" select="1"/>
</form>
@@ -64,6 +65,7 @@
<field name="name" select="1"/>
<field name="month" select="1"/>
<field name="user_id" select="1"/>
<field name="section_id" select="1"/>
<field name="nbr" select="1"/>
<field name="state" select="1"/>
</group>
@@ -92,6 +94,7 @@
<field name="arch" type="xml">
<tree string="Cases by User and Section">
<field name="name"/>
<field name="section_id" select="1"/>
<field name="month"/>
<field name="nbr"/>
<field name="state"/>
@@ -105,6 +108,7 @@
<field name="arch" type="xml">
<form string="Cases by User and Section">
<field name="name" select="1"/>
<field name="section_id" select="1"/>
<field name="month" select="1"/>
<field name="nbr" select="1"/>
<field name="state" select="1"/>
@@ -123,6 +127,7 @@
<filter string="This Month" icon="terp-hr" domain="[('month','=',time.localtime()[1])]"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="section_id" select="1"/>
<field name="nbr" select="1"/>
<field name="state" select="1"/>
</group>
@@ -157,6 +162,7 @@
<field name="arch" type="xml">
<tree string="Cases by Section">
<field name="name" select="1"/>
<field name="section_id" select="1"/>
<field name="month" select="1"/>
<field name="nbr_cases" select="1"/>
<field name="avg_answers"/>
@@ -187,6 +193,7 @@
<filter string="This Month" icon="terp-hr" domain="[('month','=',time.localtime()[1])]"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="section_id" select="1"/>
<field name="month" select="1"/>
<field name="nbr_cases" select="1"/>
</group>