[ADD]: Added Report for crm_hr. Inherited board_crm_configuration statistic view.

bzr revid: uco@tinyerp.co.in-20100120121753-ghvgt4iu1r6pphc5
This commit is contained in:
uco (OpenERP) 2010-01-20 17:47:53 +05:30
parent a6f471d5f3
commit 5391e7e3a4
7 changed files with 120 additions and 7 deletions

View File

@ -47,7 +47,7 @@
</record>
<act_window name="Leads Of The Month By User"
domain="[('name','=',time.strftime('%Y-%m-01')),('state','!=','cancel')]"
domain="[('month','=',time.strftime('%%m')),('state','!=','cancel')]"
res_model="report.crm.lead.user"
view_type="form"
view_mode="graph,tree,form"

View File

@ -22,5 +22,7 @@
import crm_hr
import report
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -30,7 +30,7 @@
""",
'author': 'Tiny',
'website': 'http://www.openerp.com',
'depends': ['crm','hr'],
'depends': ['crm','hr','board_crm_configuration'],
'init_xml': [
'crm_hr_data.xml'
],
@ -38,7 +38,8 @@
'crm_hr_wizard.xml',
'crm_hr_view.xml',
'crm_hr_menu.xml',
'security/crm_hr_security.xml',
'security/crm_hr_security.xml',
'board_crm_hr_statistical_view.xml',
],
'demo_xml': [
'crm_hr_demo.xml'

View File

@ -0,0 +1,44 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="ir.ui.view" id="view_crm_job_categ_graph">
<field name="name">report.crm.job.categ.graph</field>
<field name="model">report.crm.job.categ</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Jobs by Sections and Categories" type="bar" orientation="horizontal">
<field name="categ_id"/>
<field name="nbr" operator="+"/>
<field name="state" group="True"/>
</graph>
</field>
</record>
<act_window name="Jobs Requests Of The Month by Applied Job"
domain="[('month','=',time.strftime('%%m')),('state','!=','done'),('state','!=','cancel')]"
res_model="report.crm.job.categ"
view_type="form"
view_mode="graph,tree,form"
view_id="view_crm_job_categ_graph"
id="act_jobs_categ"/>
<record model="ir.ui.view" id="board_crm_hr_statistical_form">
<field name="name">CRM - Statistical Dashboard Form</field>
<field name="model">board.board</field>
<field name="inherit_id" ref="board_crm_configuration.board_crm_statistical_form"/>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Statistics Dashboard">
<hpaned>
<child2>
<action
string="Jobs Requests Of The Month by Applied Job"
name="%(act_jobs_categ)d"
colspan="4"/>
</child2>
</hpaned>
</form>
</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,25 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import report_crm_hr
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,41 @@
from osv import fields,osv
import tools
class report_crm_job_categ(osv.osv):
_name = "report.crm.job.categ"
_description = "Jobs by section and category"
_auto = False
_inherit = "report.crm.case.categ"
_columns = {
'categ_id': fields.many2one('crm.case.categ', 'Category', domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.job')]"),
'amount_revenue': fields.float('Est.Revenue', readonly=True),
'amount_costs': fields.float('Est.Cost', readonly=True),
'amount_revenue_prob': fields.float('Est. Rev*Prob.', readonly=True),
'probability': fields.float('Avg. Probability', readonly=True),
'delay_close': fields.char('Delay Close', size=20, readonly=True),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'report_crm_job_categ')
cr.execute("""
create or replace view report_crm_job_categ as (
select
min(c.id) as id,
to_char(c.create_date, 'YYYY') as name,
to_char(c.create_date, 'MM') as month,
c.categ_id,
c.state,
c.section_id,
count(*) as nbr,
sum(planned_revenue) as amount_revenue,
sum(planned_cost) as amount_costs,
sum(planned_revenue*probability)::decimal(16,2) as amount_revenue_prob,
avg(probability)::decimal(16,2) as probability,
to_char(avg(date_closed-c.create_date), 'DD"d" HH24:MI:SS') as delay_close
from
crm_job c
group by c.categ_id,to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'), c.state,c.section_id
)""")
report_crm_job_categ()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -60,7 +60,7 @@
<filter string="My Cases" icon="terp-hr" domain="[('user_id','=',uid)]" help="My cases by section"/>
<separator orientation="vertical"/>
<filter string="This Year" icon="terp-hr" domain="[('name','=',time.localtime()[0])]"/>
<filter string="This Month" icon="terp-hr" domain="[('month','=',time.localtime()[1])]"/>
<filter string="This Month" icon="terp-hr" domain="[('month','=',time.strftime('%%m'))]"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="month" select="1"/>
@ -124,7 +124,7 @@
<search string="Search Cases by categories and Sections">
<group col="12" colspan="4">
<filter string="This Year" icon="terp-hr" domain="[('name','=',time.localtime()[0])]"/>
<filter string="This Month" icon="terp-hr" domain="[('month','=',time.localtime()[1])]"/>
<filter string="This Month" icon="terp-hr" domain="[('month','=',time.strftime('%%m'))]"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="section_id" select="1"/>
@ -190,7 +190,7 @@
<search string="Search Cases by Section">
<group col="8" colspan="4">
<filter string="This Year" icon="terp-hr" domain="[('name','=',time.localtime()[0])]"/>
<filter string="This Month" icon="terp-hr" domain="[('month','=',time.localtime()[1])]"/>
<filter string="This Month" icon="terp-hr" domain="[('month','=',time.strftime('%%m'))]"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="section_id" select="1"/>
@ -252,7 +252,7 @@
<search string="Cases by Section and Stage">
<group col="8" colspan="4">
<filter string="This Year" icon="terp-hr" domain="[('name','=',time.localtime()[0])]" help="Cases by Section and Stage for this year"/>
<filter string="This Month" icon="terp-hr" domain="[('month','=',time.localtime()[1])]" help="Cases by Section and Stage for this month"/>
<filter string="This Month" icon="terp-hr" domain="[('month','=',time.strftime('%%m'))]" help="Cases by Section and Stage for this month"/>
<separator orientation="vertical"/>
<field name="section_id" select="1" widget="selection"/>
<field name="nbr" select="1"/>