From cde9aa41db74e59daf6d66476c4f611c2ce324ac Mon Sep 17 00:00:00 2001 From: "Vir (Open ERP)" Date: Mon, 15 Mar 2010 17:26:28 +0530 Subject: [PATCH] [ADD/MOD] crm_helpdesk : new report added for helpdesk bzr revid: vir@tinyerp.com-20100315115628-sop2obsidgbnyok9 --- addons/crm/__terp__.py | 109 ++++++------- addons/crm/report/__init__.py | 1 + addons/crm/report/crm_helpdesk_report.py | 63 ++++++++ .../crm/report/crm_helpdesk_report_view.xml | 149 ++++++++++++++++++ 4 files changed, 268 insertions(+), 54 deletions(-) create mode 100644 addons/crm/report/crm_helpdesk_report.py create mode 100644 addons/crm/report/crm_helpdesk_report_view.xml diff --git a/addons/crm/__terp__.py b/addons/crm/__terp__.py index 994f11f3212..72222a00668 100644 --- a/addons/crm/__terp__.py +++ b/addons/crm/__terp__.py @@ -41,73 +41,74 @@ appropriate staff, and making sure all future correspondence gets to the right place. The CRM module has a email gateway for the synchronisation interface -between mails and Open ERP.""", - 'author': 'Tiny', - 'website': 'http://www.openerp.com', - 'depends': ['base', 'base_action_rule', - 'process', - 'mail_gateway', +between mails and Open ERP.""", + 'author': 'Tiny', + 'website': 'http://www.openerp.com', + 'depends': ['base', 'base_action_rule', + 'process', + 'mail_gateway', 'base_calendar', - ], - 'init_xml': ['crm_data.xml', - 'crm_meeting_data.xml', - 'crm_claims_data.xml', - 'crm_fund_data.xml', - 'crm_helpdesk_data.xml', - 'crm_lead_data.xml', - 'crm_meeting_data.xml', - 'crm_opportunity_data.xml', - 'crm_phonecall_data.xml', - ], + ], + 'init_xml': ['crm_data.xml', + 'crm_meeting_data.xml', + 'crm_claims_data.xml', + 'crm_fund_data.xml', + 'crm_helpdesk_data.xml', + 'crm_lead_data.xml', + 'crm_meeting_data.xml', + 'crm_opportunity_data.xml', + 'crm_phonecall_data.xml', + ], 'update_xml': [ - 'crm_wizard.xml', - 'crm_view.xml', - 'crm_action_rule_view.xml', - 'crm_lead_wizard.xml', - 'crm_lead_view.xml', - 'crm_lead_menu.xml', - 'crm_meeting_wizard.xml', - 'crm_meeting_view.xml', - 'crm_meeting_menu.xml', - 'crm_phonecall_wizard.xml', - 'crm_phonecall_view.xml', - 'crm_phonecall_menu.xml', - 'crm_opportunity_wizard.xml', - 'crm_opportunity_view.xml', - 'crm_opportunity_menu.xml', - 'crm_fund_view.xml', - 'crm_fund_menu.xml', - 'crm_claims_view.xml', - 'crm_claims_menu.xml', + 'crm_wizard.xml', + 'crm_view.xml', + 'crm_action_rule_view.xml', + 'crm_lead_wizard.xml', + 'crm_lead_view.xml', + 'crm_lead_menu.xml', + 'crm_meeting_wizard.xml', + 'crm_meeting_view.xml', + 'crm_meeting_menu.xml', + 'crm_phonecall_wizard.xml', + 'crm_phonecall_view.xml', + 'crm_phonecall_menu.xml', + 'crm_opportunity_wizard.xml', + 'crm_opportunity_view.xml', + 'crm_opportunity_menu.xml', + 'crm_fund_view.xml', + 'crm_fund_menu.xml', + 'crm_claims_view.xml', + 'crm_claims_menu.xml', 'crm_helpdesk_view.xml', - 'crm_helpdesk_menu.xml', - - 'security/crm_security.xml', - 'security/ir.model.access.csv', + 'crm_helpdesk_menu.xml', + + 'security/crm_security.xml', + 'security/ir.model.access.csv', 'report/crm_report_view.xml', 'report/crm_claim_report_view.xml', 'report/crm_lead_report_view.xml', 'report/crm_fundraising_report_view.xml', - 'report/crm_opportunity_report_view.xml' , + 'report/crm_opportunity_report_view.xml' , 'report/crm_phonecall_report_view.xml', - + 'report/crm_helpdesk_report_view.xml', + 'process/crm_configuration_process.xml', - + ], 'demo_xml': [ - 'crm_demo.xml', - 'crm_claims_demo.xml', - 'crm_fund_demo.xml', - 'crm_helpdesk_demo.xml', - 'crm_lead_demo.xml', - 'crm_meeting_demo.xml', - 'crm_opportunity_demo.xml', - 'crm_phonecall_demo.xml'], - 'installable': True, - 'active': False, - 'certificate': '0079056041421', + 'crm_demo.xml', + 'crm_claims_demo.xml', + 'crm_fund_demo.xml', + 'crm_helpdesk_demo.xml', + 'crm_lead_demo.xml', + 'crm_meeting_demo.xml', + 'crm_opportunity_demo.xml', + 'crm_phonecall_demo.xml'], + 'installable': True, + 'active': False, + 'certificate': '0079056041421', } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/crm/report/__init__.py b/addons/crm/report/__init__.py index c93c51dd742..7030c43cfe2 100644 --- a/addons/crm/report/__init__.py +++ b/addons/crm/report/__init__.py @@ -26,6 +26,7 @@ import crm_lead_report import crm_phonecall_report import crm_fundraising_report import crm_opportunity_report +import crm_helpdesk_report # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/crm/report/crm_helpdesk_report.py b/addons/crm/report/crm_helpdesk_report.py new file mode 100644 index 00000000000..7a855378d19 --- /dev/null +++ b/addons/crm/report/crm_helpdesk_report.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +from osv import fields,osv +import tools + +class crm_helpdesk_report(osv.osv): + _name = "crm.helpdesk.report" + _description = "Helpdesk report after Sales Services" + _auto = False + _inherit = "crm.case.report" + _columns = { + 'delay_close': fields.char('Delay to close', size=20, readonly=True), + 'partner_id': fields.many2one('res.partner', 'Partner' ,readonly=True), + 'company_id': fields.many2one('res.company','Company',readonly=True), + 'date_deadline': fields.date('Deadline'), + 'priority': fields.selection([('5','Lowest'),('4','Low'),('3','Normal'),('2','High'),('1','Highest')], 'Priority'), + } + + def init(self, cr): + tools.drop_view_if_exists(cr, 'crm_helpdesk_report') + cr.execute(""" + create or replace view crm_helpdesk_report as ( + select + min(c.id) as id, + to_char(c.create_date, 'YYYY') as name, + to_char(c.create_date, 'MM') as month, + c.state, + c.user_id, + c.section_id, + c.partner_id, + c.company_id, + c.priority, + c.date_deadline, + count(*) as nbr, + 0 as avg_answers, + 0.0 as perc_done, + 0.0 as perc_cancel, + to_char(avg(date_closed-c.create_date), 'DD"d" HH24:MI:SS') as delay_close + from + crm_helpdesk c + group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'), c.state, c.user_id,c.section_id,c.priority, c.partner_id,c.company_id,c.date_deadline + )""") +crm_helpdesk_report() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/crm/report/crm_helpdesk_report_view.xml b/addons/crm/report/crm_helpdesk_report_view.xml new file mode 100644 index 00000000000..76584094da0 --- /dev/null +++ b/addons/crm/report/crm_helpdesk_report_view.xml @@ -0,0 +1,149 @@ + + + + + + + crm.helpdesk.report.tree + crm.helpdesk.report + tree + + + + + + + + + + + + + + + + + + crm.helpdesk.report.form + crm.helpdesk.report + + form + + + + + + + + + + + + crm.helpdesk.report.graph + crm.helpdesk.report + graph + + + + + + + + + + + crm.helpdesk.report.select + crm.helpdesk.report + search + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Helpdesk + crm.helpdesk.report + form + tree,graph + + + + + + + tree + + + + + + + graph + + + + + + + + +