[MOD] crm_hr : changes in applicant views, changed from crm.job to crm.applicant.
bzr revid: vir@tinyerp.com-20100217113747-9xjpghe5t4xmxbl3
This commit is contained in:
@@ -1,27 +1,27 @@
|
||||
<?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>
|
||||
<record model="ir.ui.view" id="view_crm_applicant_categ_graph">
|
||||
<field name="name">report.crm.applicant.categ.graph</field>
|
||||
<field name="model">report.crm.applicant.categ</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="Jobs by Sections and Categories" type="bar" orientation="horizontal">
|
||||
<graph string="Applicants 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"
|
||||
|
||||
<act_window name="Applicants Requests Of The Month by Applied Job"
|
||||
domain="[('month','=',time.strftime('%%m')),('state','!=','done'),('state','!=','cancel')]"
|
||||
res_model="report.crm.job.categ"
|
||||
res_model="report.crm.applicant.categ"
|
||||
view_type="form"
|
||||
view_mode="graph,tree,form"
|
||||
view_id="view_crm_job_categ_graph"
|
||||
id="act_jobs_categ"/>
|
||||
|
||||
view_id="view_crm_applicant_categ_graph"
|
||||
id="act_applicants_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>
|
||||
@@ -32,8 +32,8 @@
|
||||
<hpaned>
|
||||
<child2>
|
||||
<action
|
||||
string="Jobs Requests Of The Month by Applied Job"
|
||||
name="%(act_jobs_categ)d"
|
||||
string="Applicants Requests Of The Month by Applied Job"
|
||||
name="%(act_applicants_categ)d"
|
||||
colspan="4"/>
|
||||
</child2>
|
||||
</hpaned>
|
||||
@@ -41,4 +41,4 @@
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
</openerp>
|
||||
@@ -22,15 +22,15 @@
|
||||
from osv import fields,osv,orm
|
||||
from crm import crm
|
||||
|
||||
class crm_job(osv.osv):
|
||||
_name = "crm.job"
|
||||
_description = "Job Cases"
|
||||
class crm_applicant(osv.osv):
|
||||
_name = "crm.applicant"
|
||||
_description = "Applicant Cases"
|
||||
_order = "id desc"
|
||||
_inherit ='crm.case'
|
||||
_columns = {
|
||||
'date_closed': fields.datetime('Closed', readonly=True),
|
||||
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
|
||||
'categ_id': fields.many2one('crm.case.categ', 'Category', domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.job')]"),
|
||||
'categ_id': fields.many2one('crm.case.categ', 'Category', domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.applicant')]"),
|
||||
'planned_revenue': fields.float('Planned Revenue'),
|
||||
'planned_cost': fields.float('Planned Costs'),
|
||||
'probability': fields.float('Probability (%)'),
|
||||
@@ -38,8 +38,8 @@ class crm_job(osv.osv):
|
||||
'partner_name2': fields.char('Employee Email', size=64),
|
||||
'partner_phone': fields.char('Phone', size=32),
|
||||
'partner_mobile': fields.char('Mobile', size=32),
|
||||
'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.job')]"),
|
||||
'type_id': fields.many2one('crm.case.resource.type', 'Type Name', domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.job')]"),
|
||||
'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.applicant')]"),
|
||||
'type_id': fields.many2one('crm.case.resource.type', 'Type Name', domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.applicant')]"),
|
||||
'duration': fields.float('Duration'),
|
||||
'case_id': fields.many2one('crm.case', 'Related Case'),
|
||||
'ref' : fields.reference('Reference', selection=crm._links_get, size=128),
|
||||
@@ -53,4 +53,4 @@ class crm_job(osv.osv):
|
||||
'department_id':fields.many2one('hr.department','Department'),
|
||||
}
|
||||
|
||||
crm_job()
|
||||
crm_applicant()
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
<record model="crm.case.categ" id="categ_job1">
|
||||
<field name="name">Salesman</field>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.job')]" model="ir.model"/>
|
||||
<field name="object_id" search="[('model','=','crm.applicant')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
<record model="crm.case.categ" id="categ_job2">
|
||||
<field name="name">Junior Developer</field>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.job')]" model="ir.model"/>
|
||||
<field name="object_id" search="[('model','=','crm.applicant')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
<!-- Resource(type_id) -->
|
||||
@@ -22,17 +22,17 @@
|
||||
<record model="crm.case.resource.type" id="type_job1">
|
||||
<field name="name">Graduate</field>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.job')]" model="ir.model"/>
|
||||
<field name="object_id" search="[('model','=','crm.applicant')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.resource.type" id="type_job2">
|
||||
<field name="name">Licenced</field>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.job')]" model="ir.model"/>
|
||||
<field name="object_id" search="[('model','=','crm.applicant')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.resource.type" id="type_job3">
|
||||
<field name="name"> > Bac +5</field>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.job')]" model="ir.model"/>
|
||||
<field name="object_id" search="[('model','=','crm.applicant')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
<!-- STAGE(stage_id) -->
|
||||
@@ -40,17 +40,17 @@
|
||||
<record model="crm.case.stage" id="stage_job1">
|
||||
<field name="name">Initial Jobs Demand</field>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.job')]" model="ir.model"/>
|
||||
<field name="object_id" search="[('model','=','crm.applicant')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.stage" id="stage_job2">
|
||||
<field name="name">First Interview</field>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.job')]" model="ir.model"/>
|
||||
<field name="object_id" search="[('model','=','crm.applicant')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.stage" id="stage_job3">
|
||||
<field name="name">Second Interview</field>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.job')]" model="ir.model"/>
|
||||
<field name="object_id" search="[('model','=','crm.applicant')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.stage" id="stage_job4">
|
||||
<field name="name">Contract Proposed</field>
|
||||
@@ -60,17 +60,17 @@
|
||||
<record model="crm.case.stage" id="stage_job5">
|
||||
<field name="name">Contract Signed</field>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.job')]" model="ir.model"/>
|
||||
<field name="object_id" search="[('model','=','crm.applicant')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.stage" id="stage_job6">
|
||||
<field name="name">Refused by Employee</field>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.job')]" model="ir.model"/>
|
||||
<field name="object_id" search="[('model','=','crm.applicant')]" model="ir.model"/>
|
||||
</record>
|
||||
<record model="crm.case.stage" id="stage_job7">
|
||||
<field name="name">Refused by Company</field>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','crm.job')]" model="ir.model"/>
|
||||
<field name="object_id" search="[('model','=','crm.applicant')]" model="ir.model"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
<!--
|
||||
((((((((((( Demo Cases )))))))))))
|
||||
<!--
|
||||
((((((((((( Demo Cases )))))))))))
|
||||
-->
|
||||
|
||||
<!--For Jobs Requests-->
|
||||
<record id="crm_case_salesman0" model="crm.job">
|
||||
<record id="crm_case_salesman0" model="crm.applicant">
|
||||
<field eval="time.strftime('%Y-%m-01 10:35:50')" name="date"/>
|
||||
<field eval="time.strftime('%Y-%m-03')" name="date_deadline"/>
|
||||
<field name="type_id" ref="crm_hr.type_job1"/>
|
||||
@@ -25,7 +25,7 @@
|
||||
<field eval=""Salesman"" name="name"/>
|
||||
<field eval=""1236547890"" name="partner_phone"/>
|
||||
</record>
|
||||
<record id="crm_case_traineemca0" model="crm.job">
|
||||
<record id="crm_case_traineemca0" model="crm.applicant">
|
||||
<field model="res.partner.canal" name="canal_id" search="[('name','=','E-mail')]"/>
|
||||
<field name="partner_address_id" ref="base.res_partner_address_14"/>
|
||||
<field name="som" ref="base.som_fury"/>
|
||||
@@ -47,7 +47,7 @@
|
||||
<field eval="time.strftime('%Y-%m-15')" name="date_deadline"/>
|
||||
<field eval=""6633225"" name="partner_phone"/>
|
||||
</record>
|
||||
<record id="crm_case_fresher0" model="crm.job">
|
||||
<record id="crm_case_fresher0" model="crm.applicant">
|
||||
<field model="res.partner.canal" name="canal_id" search="[('name','=','direct')]"/>
|
||||
<field name="som" ref="base.som_happy"/>
|
||||
<field eval="time.strftime('%Y-%m-15 16:10:00')" name="date"/>
|
||||
@@ -67,7 +67,7 @@
|
||||
<field eval=""Fresher"" name="name"/>
|
||||
<field eval=""999666735"" name="partner_phone"/>
|
||||
</record>
|
||||
<record id="crm_case_yrsexperienceinphp0" model="crm.job">
|
||||
<record id="crm_case_yrsexperienceinphp0" model="crm.applicant">
|
||||
<field eval="time.strftime('%Y-%m-25 16:25:52')" name="date"/>
|
||||
<field eval="time.strftime('%Y-%m-28')" name="date_deadline"/>
|
||||
<field name="categ_id" ref="crm_hr.categ_job2"/>
|
||||
@@ -84,7 +84,7 @@
|
||||
<field name="stage_id" ref="crm_hr.stage_job6"/>
|
||||
<field eval=""More than 5 yrs Experience in PHP"" name="name"/>
|
||||
</record>
|
||||
<record id="crm_case_marketingjob0" model="crm.job">
|
||||
<record id="crm_case_marketingjob0" model="crm.applicant">
|
||||
<field eval="time.strftime('%Y-%m-26 17:15:32')" name="date"/>
|
||||
<field eval="time.strftime('%Y-%m-28')" name="date_deadline"/>
|
||||
<field name="type_id" ref="crm_hr.type_job2"/>
|
||||
@@ -103,7 +103,7 @@
|
||||
<field eval=""Marketing Job"" name="name"/>
|
||||
<field eval=""33968745"" name="partner_phone"/>
|
||||
</record>
|
||||
<record id="crm_case_financejob0" model="crm.job">
|
||||
<record id="crm_case_financejob0" model="crm.applicant">
|
||||
<field eval="time.strftime('%Y-%m-26 17:39:42')" name="date"/>
|
||||
<field eval="time.strftime('%Y-%m-28')" name="date_deadline"/>
|
||||
<field name="type_id" ref="crm_hr.type_job2"/>
|
||||
@@ -121,8 +121,8 @@
|
||||
<field name="stage_id" ref="crm_hr.stage_job5"/>
|
||||
<field eval=""Finance Job"" name="name"/>
|
||||
<field eval=""33968745"" name="partner_phone"/>
|
||||
</record>
|
||||
<record id="crm_case_traineemca1" model="crm.job">
|
||||
</record>
|
||||
<record id="crm_case_traineemca1" model="crm.applicant">
|
||||
<field model="res.partner.canal" name="canal_id" search="[('name','=','E-mail')]"/>
|
||||
<field name="partner_address_id" ref="base.res_partner_address_14"/>
|
||||
<field name="som" ref="base.som_fury"/>
|
||||
@@ -144,6 +144,6 @@
|
||||
<field eval="time.strftime('%Y-%m-15')" name="date_deadline"/>
|
||||
<field eval=""6630125"" name="partner_phone"/>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
|
||||
######################## JOB OPPORTUNITIES (menu) ###########################
|
||||
<record model="ir.actions.act_window" id="crm_case_categ0_act_job">
|
||||
<field name="name">Jobs Requests</field>
|
||||
<field name="res_model">crm.job</field>
|
||||
<field name="name">Applicants</field>
|
||||
<field name="res_model">crm.applicant</field>
|
||||
<field name="view_mode">tree,calendar,form,graph</field>
|
||||
<field name="view_id" ref="crm_case_tree_view_job"/>
|
||||
<field name="search_view_id" ref="view_crm_case_jobs_filter"/>
|
||||
<field name="search_view_id" ref="view_crm_case_jobs_filter"/>
|
||||
|
||||
</record>
|
||||
<record model="ir.actions.act_window.view" id="action_crm_sec_tree_view_act_job">
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
<record model="ir.ui.view" id="crm_case_tree_view_job">
|
||||
<field name="name">CRM - Jobs Requests Tree</field>
|
||||
<field name="model">crm.job</field>
|
||||
<field name="model">crm.applicant</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Jobs - Recruitment Tree" colors="red:state=='open';black:state in ('draft', 'cancel','done','pending')">
|
||||
@@ -58,7 +58,7 @@
|
||||
|
||||
<record model="ir.ui.view" id="crm_case_form_view_job">
|
||||
<field name="name">CRM - Jobs Requests Form</field>
|
||||
<field name="model">crm.job</field>
|
||||
<field name="model">crm.applicant</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Jobs - Recruitment Form">
|
||||
@@ -66,38 +66,31 @@
|
||||
<field name="name" string="Description" colspan="2"/>
|
||||
<field name="section_id" colspan="1" widget="selection"/>
|
||||
<field name="user_id" string="Responsible" select="2"/>
|
||||
<button string="Schedule a Phone Call"
|
||||
name="%(wizard_crm_job_reschedule_phone_call)d" icon="gtk-redo" type="action" attrs="{'invisible':[('phonecall_id','!=',False)]}"/>
|
||||
<newline/>
|
||||
<label string="Stage: " align="1.0"/>
|
||||
<group colspan="1" col="2">
|
||||
<field name="stage_id" select="1" nolabel="1"/>
|
||||
<button icon="gtk-go-forward" string="" name="stage_next" type="object"/>
|
||||
</group>
|
||||
<field name="date" string="Next Interview"/>
|
||||
<field name="duration" widget="float_time"/>
|
||||
<field name="partner_name" string="Candidate Name"/>
|
||||
<field name="partner_phone"/>
|
||||
<button name="%(wizard_crm_job_meeting_set)d" string="Schedule Meeting" icon="terp-crm" type="action"/>
|
||||
<field name="phonecall_id" select="1"/>
|
||||
<button string="Schedule a Phone Call"
|
||||
name="%(wizard_crm_job_reschedule_phone_call)d" icon="gtk-redo" type="action" attrs="{'invisible':[('phonecall_id','!=',False)]}"/>
|
||||
<field name="department_id" />
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Job Info">
|
||||
<field name="partner_name" string="Candidate Name"/>
|
||||
<field name="partner_name2" string="Candidate Name2"/>
|
||||
<newline/>
|
||||
<field name="partner_phone"/>
|
||||
<field name="partner_mobile"/>
|
||||
<field name="email_from" string="Candidate Email"/>
|
||||
<field name="email_from" string="Candidate Email" widget="email"/>
|
||||
<newline/>
|
||||
<group colspan="2" col="3">
|
||||
<field name="partner_id" on_change="onchange_partner_id(partner_id, email_from)" />
|
||||
<button string="Convert to Partner"
|
||||
<field name="partner_id" on_change="onchange_partner_id(partner_id, email_from)" />
|
||||
<field name="partner_address_id" string="Contact" on_change="onchange_partner_address_id(partner_address_id, email_from)" colspan="1"/>
|
||||
<button string="Convert to Partner"
|
||||
icon="terp-partner" name="%(wizard_crm_job_partner_create)d"
|
||||
type="action" attrs="{'invisible':[('partner_id','!=',False)]}"
|
||||
/>
|
||||
</group>
|
||||
<field name="partner_address_id" string="Contact" on_change="onchange_partner_address_id(partner_address_id, email_from)" colspan="1"/>
|
||||
<newline/>
|
||||
<newline/>
|
||||
<separator colspan="4" string="Contract Data"/>
|
||||
<field name="probability" string="Availability (weeks)"/>
|
||||
<newline/>
|
||||
@@ -177,7 +170,7 @@
|
||||
|
||||
<record model="ir.ui.view" id="crm_case_calendar_view_job">
|
||||
<field name="name">CRM - Jobs Requests Calendar</field>
|
||||
<field name="model">crm.job</field>
|
||||
<field name="model">crm.applicant</field>
|
||||
<field name="type">calendar</field>
|
||||
<field name="priority" eval="2"/>
|
||||
<field name="arch" type="xml">
|
||||
@@ -191,7 +184,7 @@
|
||||
|
||||
<record model="ir.ui.view" id="crm_case_graph_view_job">
|
||||
<field name="name">CRM - Jobs Requests Graph</field>
|
||||
<field name="model">crm.job</field>
|
||||
<field name="model">crm.applicant</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="Cases By Stage and Estimates" type="bar" orientation="vertical">
|
||||
@@ -239,11 +232,11 @@
|
||||
<field name="email_from" select='1' string="Email"/>
|
||||
<field name="user_id" select="1" widget="selection"/>
|
||||
</group>
|
||||
<field name="section_id" select="1" widget="selection" string="Section">
|
||||
<filter icon="terp-crm"
|
||||
domain="[('section_id','=',context.get('section_id',False))]"
|
||||
help="My section"
|
||||
/>
|
||||
<field name="department_id" select="1" widget="selection" string="Department">
|
||||
<!-- <filter icon="terp-crm"-->
|
||||
<!-- domain="[('section_id','=',context.get('section_id',False))]"-->
|
||||
<!-- help="My section"-->
|
||||
<!-- />-->
|
||||
</field>
|
||||
</search>
|
||||
</field>
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<data>
|
||||
<wizard
|
||||
id="wizard_crm_job_reschedule_phone_call"
|
||||
keyword="client_action_multi"
|
||||
model="crm.job"
|
||||
name="crm.job.reschedule_phone_call"
|
||||
model="crm.applicant"
|
||||
name="crm.applicant.reschedule_phone_call"
|
||||
multi="True"
|
||||
string="Schedule Phone Call" />
|
||||
string="Schedule Phone Call" />
|
||||
|
||||
<wizard
|
||||
id="wizard_crm_job_meeting_set"
|
||||
keyword="client_action_multi"
|
||||
model="crm.job"
|
||||
name="crm.job.meeting_set"
|
||||
model="crm.applicant"
|
||||
name="crm.applicant.meeting_set"
|
||||
multi="True"
|
||||
string="Schedule Meeting"/>
|
||||
string="Schedule Meeting"/>
|
||||
|
||||
<wizard
|
||||
id="wizard_crm_job_partner_create"
|
||||
keyword="client_action_multi"
|
||||
model="crm.job"
|
||||
name="crm.job.partner_create"
|
||||
model="crm.applicant"
|
||||
name="crm.applicant.partner_create"
|
||||
multi="True"
|
||||
string="Create Partner"/>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
from osv import fields,osv
|
||||
import tools
|
||||
|
||||
class report_crm_job_user(osv.osv):
|
||||
_name = "report.crm.job.user"
|
||||
_description = "Job by user and section"
|
||||
class report_crm_applicant_user(osv.osv):
|
||||
_name = "report.crm.applicant.user"
|
||||
_description = "Applicant by user and section"
|
||||
_auto = False
|
||||
_inherit = "report.crm.case.user"
|
||||
_columns = {
|
||||
@@ -14,9 +14,9 @@ class report_crm_job_user(osv.osv):
|
||||
'delay_close': fields.char('Delay to close', size=20, readonly=True),
|
||||
}
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'report_crm_job_user')
|
||||
tools.drop_view_if_exists(cr, 'report_crm_applicant_user')
|
||||
cr.execute("""
|
||||
create or replace view report_crm_job_user as (
|
||||
create or replace view report_crm_applicant_user as (
|
||||
select
|
||||
min(c.id) as id,
|
||||
to_char(c.create_date, 'YYYY') as name,
|
||||
@@ -31,29 +31,29 @@ class report_crm_job_user(osv.osv):
|
||||
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
|
||||
crm_applicant c
|
||||
group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'), c.state, c.user_id,c.section_id
|
||||
)""")
|
||||
report_crm_job_user()
|
||||
report_crm_applicant_user()
|
||||
|
||||
class report_crm_job_categ(osv.osv):
|
||||
_name = "report.crm.job.categ"
|
||||
_description = "Jobs by section and category"
|
||||
class report_crm_applicant_categ(osv.osv):
|
||||
_name = "report.crm.applicant.categ"
|
||||
_description = "Applicants 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')]"),
|
||||
'categ_id': fields.many2one('crm.case.categ', 'Category', domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.applicant')]"),
|
||||
'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')
|
||||
tools.drop_view_if_exists(cr, 'report_crm_applicant_categ')
|
||||
cr.execute("""
|
||||
create or replace view report_crm_job_categ as (
|
||||
create or replace view report_crm_applicant_categ as (
|
||||
select
|
||||
min(c.id) as id,
|
||||
to_char(c.create_date, 'YYYY') as name,
|
||||
@@ -68,39 +68,39 @@ class report_crm_job_categ(osv.osv):
|
||||
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
|
||||
crm_applicant 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()
|
||||
report_crm_applicant_categ()
|
||||
|
||||
class report_crm_job_section(osv.osv):
|
||||
_name = "report.crm.job.section"
|
||||
_description = "job by Section"
|
||||
class report_crm_applicant_section(osv.osv):
|
||||
_name = "report.crm.applicant.section"
|
||||
_description = "Applicant by Section"
|
||||
_auto = False
|
||||
_inherit = "report.crm.case.section"
|
||||
|
||||
|
||||
def _get_data(self, cr, uid, ids, field_name, arg, context={}):
|
||||
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_job where section_id =%s and state='%s'"%(case.section_id.id,state))
|
||||
cr.execute("select count(*) from crm_applicant where section_id =%s and state='%s'"%(case.section_id.id,state))
|
||||
state_cases = cr.fetchone()[0]
|
||||
perc_state = (state_cases / float(case.nbr_cases) ) * 100
|
||||
|
||||
|
||||
res[case.id] = perc_state
|
||||
else:
|
||||
cr.execute('select count(*) from crm_case_log l where l.section_id=%s'%(case.section_id.id))
|
||||
logs = cr.fetchone()[0]
|
||||
|
||||
|
||||
avg_ans = logs / case.nbr_cases
|
||||
res[case.id] = avg_ans
|
||||
|
||||
res[case.id] = avg_ans
|
||||
|
||||
return res
|
||||
|
||||
|
||||
_columns = {
|
||||
'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"),
|
||||
@@ -109,9 +109,9 @@ class report_crm_job_section(osv.osv):
|
||||
}
|
||||
_order = 'name desc, section_id'
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'report_crm_job_section')
|
||||
tools.drop_view_if_exists(cr, 'report_crm_applicant_section')
|
||||
cr.execute("""
|
||||
create or replace view report_crm_job_section as (
|
||||
create or replace view report_crm_applicant_section as (
|
||||
select
|
||||
min(c.id) as id,
|
||||
to_char(c.create_date, 'YYYY') as name,
|
||||
@@ -123,9 +123,9 @@ class report_crm_job_section(osv.osv):
|
||||
0.0 as perc_cancel,
|
||||
to_char(avg(date_closed-c.create_date), 'DD"d" HH24:MI:SS') as delay_close
|
||||
from
|
||||
crm_job c
|
||||
crm_applicant c
|
||||
group by to_char(c.create_date, 'YYYY'),to_char(c.create_date, 'MM'),c.section_id
|
||||
)""")
|
||||
report_crm_job_section()
|
||||
report_crm_applicant_section()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
-->
|
||||
|
||||
<record id="view_crm_job_user_tree" model="ir.ui.view">
|
||||
<field name="name">report.crm.job.user.tree</field>
|
||||
<field name="model">report.crm.job.user</field>
|
||||
<field name="name">report.crm.applicant.user.tree</field>
|
||||
<field name="model">report.crm.applicant.user</field>
|
||||
<field name="inherit_id" ref="report_crm.view_crm_case_user_tree"/>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
@@ -21,8 +21,8 @@
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_crm_job_user_form" model="ir.ui.view">
|
||||
<field name="name">report.crm.job.user.form</field>
|
||||
<field name="model">report.crm.job.user</field>
|
||||
<field name="name">report.crm.applicant.user.form</field>
|
||||
<field name="model">report.crm.applicant.user</field>
|
||||
<field name="inherit_id" ref="report_crm.view_crm_case_user_form"/>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
@@ -37,8 +37,8 @@
|
||||
</record>
|
||||
|
||||
<record id="view_crm_job_user_graph" model="ir.ui.view">
|
||||
<field name="name">report.crm.job.user.graph</field>
|
||||
<field name="model">report.crm.job.user</field>
|
||||
<field name="name">report.crm.applicant.user.graph</field>
|
||||
<field name="model">report.crm.applicant.user</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph orientation="horizontal" string="jobs by User and Section" type="bar">
|
||||
@@ -50,8 +50,8 @@
|
||||
</record>
|
||||
|
||||
<record id="view_crm_job_user_filter" model="ir.ui.view">
|
||||
<field name="name">report.crm.job.user.select</field>
|
||||
<field name="model">report.crm.job.user</field>
|
||||
<field name="name">report.crm.applicant.user.select</field>
|
||||
<field name="model">report.crm.applicant.user</field>
|
||||
<field name="inherit_id" ref="report_crm.view_crm_case_user_filter"/>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
<record id="action_report_crm_job_user_tree" model="ir.actions.act_window">
|
||||
<field name="name">Jobs by User and Section</field>
|
||||
<field name="res_model">report.crm.job.user</field>
|
||||
<field name="res_model">report.crm.applicant.user</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">graph,tree</field>
|
||||
<field name="view_id" ref="view_crm_job_user_graph"/>
|
||||
@@ -79,8 +79,8 @@
|
||||
<!-- # jobs by section and category of case -->
|
||||
|
||||
<record id="view_crm_job_categ_tree" model="ir.ui.view">
|
||||
<field name="name">report.crm.job.categ.tree</field>
|
||||
<field name="model">report.crm.job.categ</field>
|
||||
<field name="name">report.crm.applicant.categ.tree</field>
|
||||
<field name="model">report.crm.applicant.categ</field>
|
||||
<field name="inherit_id" ref="report_crm.view_crm_case_categ_tree"/>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
@@ -94,8 +94,8 @@
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_crm_job_categ_form" model="ir.ui.view">
|
||||
<field name="name">report.crm.job.categ.form</field>
|
||||
<field name="model">report.crm.job.categ</field>
|
||||
<field name="name">report.crm.applicant.categ.form</field>
|
||||
<field name="model">report.crm.applicant.categ</field>
|
||||
<field name="inherit_id" ref="report_crm.view_crm_case_categ_form"/>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
@@ -110,8 +110,8 @@
|
||||
</record>
|
||||
|
||||
<record id="view_crm_job_categ_graph" model="ir.ui.view">
|
||||
<field name="name">report.crm.job.categ.graph</field>
|
||||
<field name="model">report.crm.job.categ</field>
|
||||
<field name="name">report.crm.applicant.categ.graph</field>
|
||||
<field name="model">report.crm.applicant.categ</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph orientation="horizontal" string="jobs by Section and Categories" type="bar">
|
||||
@@ -123,8 +123,8 @@
|
||||
</record>
|
||||
|
||||
<record id="view_crm_job_categ_filter" model="ir.ui.view">
|
||||
<field name="name">report.crm.job.categ.select</field>
|
||||
<field name="model">report.crm.job.categ</field>
|
||||
<field name="name">report.crm.applicant.categ.select</field>
|
||||
<field name="model">report.crm.applicant.categ</field>
|
||||
<field name="inherit_id" ref="report_crm.view_crm_case_categ_filter"/>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
@@ -135,7 +135,7 @@
|
||||
|
||||
<record id="action_report_crm_job_categ_tree" model="ir.actions.act_window">
|
||||
<field name="name">Jobs by Categories and Section</field>
|
||||
<field name="res_model">report.crm.job.categ</field>
|
||||
<field name="res_model">report.crm.applicant.categ</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">graph,tree</field>
|
||||
<field name="view_id" ref="view_crm_job_categ_graph"/>
|
||||
@@ -146,8 +146,8 @@
|
||||
<!-- jobs by Section -->
|
||||
|
||||
<record id="view_report_crm_job_section_tree" model="ir.ui.view">
|
||||
<field name="name">report.crm.job.section.tree</field>
|
||||
<field name="model">report.crm.job.section</field>
|
||||
<field name="name">report.crm.applicant.section.tree</field>
|
||||
<field name="model">report.crm.applicant.section</field>
|
||||
<field name="inherit_id" ref="report_crm.view_report_crm_case_section_tree"/>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
@@ -161,8 +161,8 @@
|
||||
</record>
|
||||
|
||||
<record id="view_report_crm_job_section_graph" model="ir.ui.view">
|
||||
<field name="name">report.crm.job.section.graph</field>
|
||||
<field name="model">report.crm.job.section</field>
|
||||
<field name="name">report.crm.applicant.section.graph</field>
|
||||
<field name="model">report.crm.applicant.section</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph orientation="horizontal" string="jobs by Section" type="bar">
|
||||
@@ -173,8 +173,8 @@
|
||||
</record>
|
||||
|
||||
<record id="view_report_crm_job_section_filter" model="ir.ui.view">
|
||||
<field name="name">report.crm.job.section.select</field>
|
||||
<field name="model">report.crm.job.section</field>
|
||||
<field name="name">report.crm.applicant.section.select</field>
|
||||
<field name="model">report.crm.applicant.section</field>
|
||||
<field name="inherit_id" ref="report_crm.view_report_crm_case_section_filter"/>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
@@ -185,7 +185,7 @@
|
||||
|
||||
<record id="action_report_crm_job_section_tree" model="ir.actions.act_window">
|
||||
<field name="name">Jobs by Section</field>
|
||||
<field name="res_model">report.crm.job.section</field>
|
||||
<field name="res_model">report.crm.applicant.section</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">graph,tree</field>
|
||||
<field name="view_id" ref="view_report_crm_job_section_graph"/>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"access_crm_job","crm.job","model_crm_job","crm.group_crm_manager",1,1,1,1
|
||||
"access_report_crm_job_user","report.crm.job.user","model_report_crm_job_user","crm.group_crm_manager",1,0,0,0
|
||||
"access_report_crm_job_categ","report.crm.job.categ","model_report_crm_job_categ","crm.group_crm_manager",1,0,0,0
|
||||
"access_repor_crm_job_section","report.crm.job.section","model_report_crm_job_section","crm.group_crm_manager",1,0,0,0
|
||||
"access_crm_applicant","crm.applicant","model_crm_applicant","crm.group_crm_manager",1,1,1,1
|
||||
"access_report_crm_applicant_user","report.crm.applicant.user","model_report_crm_applicant_user","crm.group_crm_manager",1,0,0,0
|
||||
"access_report_crm_applicant_categ","report.crm.applicant.categ","model_report_crm_applicant_categ","crm.group_crm_manager",1,0,0,0
|
||||
"access_repor_crm_applicant_section","report.crm.applicant.section","model_report_crm_applicant_section","crm.group_crm_manager",1,0,0,0
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
<data>
|
||||
<record id="crm.menu_crm_case_job_req_main" model="ir.ui.menu">
|
||||
<field eval="Jobs Requests" name="name"/>
|
||||
<field eval="Applicants" name="name"/>
|
||||
<field eval=""terp-hr"" name="icon"/>
|
||||
<field eval="False" name="parent_id"/>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user