[REM]: crm*: Removed unused fields(perc_done, perc_cancel, avg_answers) + code in reporting

bzr revid: rpa@tinyerp.com-20101005131307-4o487rfg3gynn3sx
This commit is contained in:
rpa (Open ERP)
2010-10-05 18:43:07 +05:30
parent d31b4e3d0b
commit 615bce075b
14 changed files with 1 additions and 249 deletions
-41
View File
@@ -37,41 +37,6 @@ class crm_lead_report(osv.osv):
_auto = False
_description = "CRM Lead Report"
def _get_data(self, cr, uid, ids, field_name, arg, context={}):
""" @param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of case and section Data’s IDs
@param context: A standard dictionary for contextual values """
res = {}
avg_ans = 0.0
for case in self.browse(cr, uid, ids, context):
if field_name != 'avg_answers':
state = field_name[5:]
cr.execute("select count(id) from crm_lead where \
section_id =%s and state='%s'"%(case.section_id.id, state))
state_cases = cr.fetchone()[0]
perc_state = (state_cases / float(case.nbr)) * 100
res[case.id] = perc_state
else:
model_name = self._name.split('report.')
if len(model_name) < 2:
res[case.id] = 0.0
else:
model_name = model_name[1]
cr.execute("select count(id) from crm_case_log l, ir_model m \
where l.model_id=m.id and m.model = '%s'" , model_name)
logs = cr.fetchone()[0]
avg_ans = logs / case.nbr
res[case.id] = avg_ans
return res
_columns = {
'name': fields.char('Year', size=64, required=False, readonly=True),
'user_id':fields.many2one('res.users', 'User', readonly=True),
@@ -80,9 +45,6 @@ class crm_lead_report(osv.osv):
'channel_id':fields.many2one('res.partner.canal', 'Channel', readonly=True),
'type_id':fields.many2one('crm.case.resource.type', 'Campaign', readonly=True),
'state': fields.selection(AVAILABLE_STATES, 'State', size=16, 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"),
'perc_cancel': fields.function(_get_data, string='%Cancel', method=True, type="float"),
'month':fields.selection([('01', 'January'), ('02', 'February'), \
('03', 'March'), ('04', 'April'),\
('05', 'May'), ('06', 'June'), \
@@ -147,9 +109,6 @@ class crm_lead_report(osv.osv):
c.planned_revenue,
c.planned_revenue*(c.probability/100) as probable_revenue,
1 as nbr,
0 as avg_answers,
0.0 as perc_done,
0.0 as perc_cancel,
(SELECT count(id) FROM mailgate_message WHERE model='crm.lead' AND res_id=c.id AND history=True) AS email,
date_trunc('day',c.create_date) as create_date,
extract('epoch' from (c.date_closed-c.create_date))/(3600*24) as delay_close,
@@ -29,7 +29,6 @@
<field name="email" sum="# Mails"/>
<field name="delay_open"/>
<field name="delay_close"/>
<field name="avg_answers"/>
</tree>
</field>
</record>
-42
View File
@@ -39,42 +39,6 @@ class crm_phonecall_report(osv.osv):
_description = "Phone calls by user and section"
_auto = False
def _get_data(self, cr, uid, ids, field_name, arg, context={}):
""" @param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of case and section Data’s IDs
@param context: A standard dictionary for contextual values """
res = {}
state_perc = 0.0
avg_ans = 0.0
for case in self.browse(cr, uid, ids, context):
if field_name != 'avg_answers':
state = field_name[5:]
cr.execute("select count(*) from crm_lead where \
section_id =%s and state='%s'"%(case.section_id.id, state))
state_cases = cr.fetchone()[0]
perc_state = (state_cases / float(case.nbr)) * 100
res[case.id] = perc_state
else:
model_name = self._name.split('report.')
if len(model_name) < 2:
res[case.id] = 0.0
else:
model_name = model_name[1]
cr.execute("select count(*) from crm_case_log l, ir_model m \
where l.model_id=m.id and m.model = '%s'" , model_name)
logs = cr.fetchone()[0]
avg_ans = logs / case.nbr
res[case.id] = avg_ans
return res
_columns = {
'name': fields.char('Year', size=64, required=False, readonly=True),
'user_id':fields.many2one('res.users', 'User', readonly=True),
@@ -82,9 +46,6 @@ class crm_phonecall_report(osv.osv):
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
'nbr': fields.integer('# of Cases', readonly=True),
'state': fields.selection(AVAILABLE_STATES, 'State', size=16, 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"),
'perc_cancel': fields.function(_get_data, string='%Cancel', method=True, type="float"),
'month':fields.selection([('01', 'January'), ('02', 'February'), \
('03', 'March'), ('04', 'April'),\
('05', 'May'), ('06', 'June'), \
@@ -131,9 +92,6 @@ class crm_phonecall_report(osv.osv):
c.company_id,
c.priority,
1 as nbr,
0 as avg_answers,
0.0 as perc_done,
0.0 as perc_cancel,
date_trunc('day',c.create_date) as create_date,
extract('epoch' from (c.date_closed-c.create_date))/(3600*24) as delay_close,
extract('epoch' from (c.date_open-c.create_date))/(3600*24) as delay_open
-15
View File
@@ -254,11 +254,6 @@ msgstr "Convert To Partner"
msgid "Recruitments Statistics"
msgstr "Recruitments Statistics"
#. module: hr_recruitment
#: field:hr.recruitment.report,perc_done:0
msgid "%Done"
msgstr "%Done"
#. module: hr_recruitment
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
@@ -312,11 +307,6 @@ msgstr "Email"
msgid "Availability (Days)"
msgstr "Availability (Days)"
#. module: hr_recruitment
#: field:hr.recruitment.report,avg_answers:0
msgid "Avg. Answers"
msgstr "Avg. Answers"
#. module: hr_recruitment
#: view:hr.recruitment.report:0
msgid "Available"
@@ -464,11 +454,6 @@ msgstr "Stage of Recruitment"
msgid "Stages"
msgstr "Stages"
#. module: hr_recruitment
#: field:hr.recruitment.report,perc_cancel:0
msgid "%Cancel"
msgstr "%Cancel"
#. module: hr_recruitment
#: field:hr.applicant,probability:0
msgid "Probability"
-15
View File
@@ -257,11 +257,6 @@ msgstr ""
msgid "Recruitments Statistics"
msgstr ""
#. module: hr_recruitment
#: field:hr.recruitment.report,perc_done:0
msgid "%Done"
msgstr ""
#. module: hr_recruitment
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
@@ -315,11 +310,6 @@ msgstr ""
msgid "Availability (Days)"
msgstr ""
#. module: hr_recruitment
#: field:hr.recruitment.report,avg_answers:0
msgid "Avg. Answers"
msgstr ""
#. module: hr_recruitment
#: view:hr.recruitment.report:0
msgid "Available"
@@ -467,11 +457,6 @@ msgstr ""
msgid "Stages"
msgstr ""
#. module: hr_recruitment
#: field:hr.recruitment.report,perc_cancel:0
msgid "%Cancel"
msgstr ""
#. module: hr_recruitment
#: field:hr.applicant,probability:0
msgid "Probability"
@@ -254,11 +254,6 @@ msgstr ""
msgid "Recruitments Statistics"
msgstr ""
#. module: hr_recruitment
#: field:hr.recruitment.report,perc_done:0
msgid "%Done"
msgstr ""
#. module: hr_recruitment
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
@@ -464,11 +459,6 @@ msgstr ""
msgid "Stages"
msgstr ""
#. module: hr_recruitment
#: field:hr.recruitment.report,perc_cancel:0
msgid "%Cancel"
msgstr ""
#. module: hr_recruitment
#: field:hr.applicant,probability:0
msgid "Probability"
-15
View File
@@ -258,11 +258,6 @@ msgstr ""
msgid "Recruitments Statistics"
msgstr ""
#. module: hr_recruitment
#: field:hr.recruitment.report,perc_done:0
msgid "%Done"
msgstr ""
#. module: hr_recruitment
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
@@ -316,11 +311,6 @@ msgstr ""
msgid "Availability (Days)"
msgstr ""
#. module: hr_recruitment
#: field:hr.recruitment.report,avg_answers:0
msgid "Avg. Answers"
msgstr ""
#. module: hr_recruitment
#: view:hr.recruitment.report:0
msgid "Available"
@@ -468,11 +458,6 @@ msgstr ""
msgid "Stages"
msgstr ""
#. module: hr_recruitment
#: field:hr.recruitment.report,perc_cancel:0
msgid "%Cancel"
msgstr ""
#. module: hr_recruitment
#: field:hr.applicant,probability:0
msgid "Probability"
@@ -36,26 +36,10 @@ class hr_recruitment_report(osv.osv):
_auto = False
_rec_name = 'date'
def _get_data(self, cr, uid, ids, field_name, arg, context={}):
""" @param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of case and section Data’s IDs
@param context: A standard dictionary for contextual values """
res = {}
state_perc = 0.0
avg_ans = 0.0
#TODO: Calculate avg_answer, perc_done, perc_cancel
return res
_columns = {
'user_id':fields.many2one('res.users', 'User', readonly=True),
'nbr': fields.integer('# of Cases', readonly=True),
'state': fields.selection(AVAILABLE_STATES, 'State', size=16, 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"),
'perc_cancel': fields.function(_get_data, string='%Cancel', method=True, type="float"),
'month':fields.selection([('01', 'January'), ('02', 'February'), \
('03', 'March'), ('04', 'April'),\
('05', 'May'), ('06', 'June'), \
-15
View File
@@ -230,11 +230,6 @@ msgstr "Invalid model name in the action definition."
msgid "Section"
msgstr "Section"
#. module: project_issue
#: field:project.issue.report,perc_done:0
msgid "%Done"
msgstr "%Done"
#. module: project_issue
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
@@ -291,11 +286,6 @@ msgstr "Email"
msgid "Channel"
msgstr "Channel"
#. module: project_issue
#: field:project.issue.report,avg_answers:0
msgid "Avg. Answers"
msgstr "Avg. Answers"
#. module: project_issue
#: selection:project.issue,priority:0
#: selection:project.issue.report,priority:0
@@ -399,11 +389,6 @@ msgstr "The channels represent the different communication modes available with
msgid "Tasks"
msgstr "Tasks"
#. module: project_issue
#: field:project.issue.report,perc_cancel:0
msgid "%Cancel"
msgstr "%Cancel"
#. module: project_issue
#: field:project.issue.report,nbr:0
msgid "# of Issues"
-15
View File
@@ -235,11 +235,6 @@ msgstr ""
msgid "Section"
msgstr ""
#. module: project_issue
#: field:project.issue.report,perc_done:0
msgid "%Done"
msgstr ""
#. module: project_issue
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
@@ -296,11 +291,6 @@ msgstr ""
msgid "Channel"
msgstr ""
#. module: project_issue
#: field:project.issue.report,avg_answers:0
msgid "Avg. Answers"
msgstr ""
#. module: project_issue
#: selection:project.issue,priority:0
#: selection:project.issue.report,priority:0
@@ -407,11 +397,6 @@ msgstr ""
msgid "Tasks"
msgstr ""
#. module: project_issue
#: field:project.issue.report,perc_cancel:0
msgid "%Cancel"
msgstr ""
#. module: project_issue
#: field:project.issue.report,nbr:0
msgid "# of Issues"
-15
View File
@@ -236,11 +236,6 @@ msgstr ""
msgid "Section"
msgstr ""
#. module: project_issue
#: field:project.issue.report,perc_done:0
msgid "%Done"
msgstr ""
#. module: project_issue
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
@@ -297,11 +292,6 @@ msgstr ""
msgid "Channel"
msgstr ""
#. module: project_issue
#: field:project.issue.report,avg_answers:0
msgid "Avg. Answers"
msgstr ""
#. module: project_issue
#: selection:project.issue,priority:0
#: selection:project.issue.report,priority:0
@@ -408,11 +398,6 @@ msgstr ""
msgid "Tasks"
msgstr ""
#. module: project_issue
#: field:project.issue.report,perc_cancel:0
msgid "%Cancel"
msgstr ""
#. module: project_issue
#: field:project.issue.report,nbr:0
msgid "# of Issues"
-15
View File
@@ -240,11 +240,6 @@ msgstr "Nieprawidłowa nazwa modelu w definicji akcji."
msgid "Section"
msgstr "Sekcja"
#. module: project_issue
#: field:project.issue.report,perc_done:0
msgid "%Done"
msgstr "%Wykonano"
#. module: project_issue
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
@@ -301,11 +296,6 @@ msgstr "E-mail"
msgid "Channel"
msgstr "Kanał"
#. module: project_issue
#: field:project.issue.report,avg_answers:0
msgid "Avg. Answers"
msgstr "Śred. odpowiedzi"
#. module: project_issue
#: selection:project.issue,priority:0
#: selection:project.issue.report,priority:0
@@ -414,11 +404,6 @@ msgstr ""
msgid "Tasks"
msgstr "Zadania"
#. module: project_issue
#: field:project.issue.report,perc_cancel:0
msgid "%Cancel"
msgstr "%Anulowanych"
#. module: project_issue
#: field:project.issue.report,nbr:0
msgid "# of Issues"
@@ -230,11 +230,6 @@ msgstr ""
msgid "Section"
msgstr ""
#. module: project_issue
#: field:project.issue.report,perc_done:0
msgid "%Done"
msgstr ""
#. module: project_issue
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
@@ -399,11 +394,6 @@ msgstr ""
msgid "Tasks"
msgstr ""
#. module: project_issue
#: field:project.issue.report,perc_cancel:0
msgid "%Cancel"
msgstr ""
#. module: project_issue
#: field:project.issue.report,nbr:0
msgid "# of Issues"
@@ -35,34 +35,11 @@ class project_issue_report(osv.osv):
_name = "project.issue.report"
_auto = False
def _get_data(self, cr, uid, ids, field_names, arg, context=None):
if context is None:
context = {}
""" @param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case and section Datas IDs
@param context: A standard dictionary for contextual values """
res = {}
for report in self.browse(cr, uid, ids, context):
res[report.id]= {
'avg_answers': 0.0,
'perc_done' : 0.0,
'perc_cancel': 0.0
}
#TODO: Calculate
return res
_columns = {
'name': fields.char('Year', size=64, required=False, readonly=True),
'user_id':fields.many2one('res.users', 'Responsible', readonly=True),
'section_id':fields.many2one('crm.case.section', 'Section', readonly=True),
'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True),
'avg_answers': fields.function(_get_data, group_operator='avg', string='Avg. Answers', multi='avg_answers', method=True, type="integer"),
'perc_done': fields.function(_get_data, group_operator='avg', string='%Done', multi='perc_done', method=True, type="float"),
'perc_cancel': fields.function(_get_data, group_operator='avg', string='%Cancel', multi='perc_cancel', method=True, type="float"),
'month':fields.selection([('01', 'January'), ('02', 'February'), \
('03', 'March'), ('04', 'April'),\
('05', 'May'), ('06', 'June'), \
@@ -75,7 +52,7 @@ class project_issue_report(osv.osv):
'creation_date': fields.date('Creation Date', readonly=True),
'date_closed': fields.date('Date of Closing', readonly=True),
'categ_id': fields.many2one('crm.case.categ', 'Category', domain="[('section_id','=',section_id),('object_id.model', '=', 'project.issue')]"),
'type_id': fields.many2one ('project.task.type', 'Stage'),
'type_id': fields.many2one('project.task.type', 'Stage'),
'nbr': fields.integer('# of Issues', readonly=True),
'working_hours_open': fields.float('Avg. Working Hours to Open', readonly=True),
'working_hours_close': fields.float('Avg. Working Hours to Close', readonly=True),