diff --git a/addons/crm_hr/board_crm_hr_statistical_view.xml b/addons/crm_hr/board_crm_hr_statistical_view.xml
index c70ac559a5e..80dc214f30d 100644
--- a/addons/crm_hr/board_crm_hr_statistical_view.xml
+++ b/addons/crm_hr/board_crm_hr_statistical_view.xml
@@ -1,27 +1,27 @@
-
- report.crm.job.categ.graph
- report.crm.job.categ
+
+ report.crm.applicant.categ.graph
+ report.crm.applicant.categ
graph
-
+
-
-
-
+ view_id="view_crm_applicant_categ_graph"
+ id="act_applicants_categ"/>
+
CRM - Statistical Dashboard Form
board.board
@@ -32,8 +32,8 @@
@@ -41,4 +41,4 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/addons/crm_hr/crm_hr.py b/addons/crm_hr/crm_hr.py
index b122cc6b9e9..5a58af0c3b3 100644
--- a/addons/crm_hr/crm_hr.py
+++ b/addons/crm_hr/crm_hr.py
@@ -22,24 +22,24 @@
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 = {
+ _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')]"),
+ 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
+ '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 (%)'),
+ 'probability': fields.float('Probability (%)'),
'partner_name': fields.char("Employee's Name", size=64),
'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')]"),
+ 'partner_mobile': fields.char('Mobile', size=32),
+ '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),
@@ -49,7 +49,8 @@ class crm_job(osv.osv):
'som': fields.many2one('res.partner.som', 'State of Mind', help="The minds states allow to define a value scale which represents" \
"the partner mentality in relation to our services.The scale has" \
"to be created with a factor for each level from 0 (Very dissatisfied) to 10 (Extremely satisfied)."),
- 'phonecall_id':fields.many2one ('crm.phonecall', 'Phonecall'),
+ 'phonecall_id':fields.many2one ('crm.phonecall', 'Phonecall'),
+ 'department_id':fields.many2one('hr.department','Department'),
}
-
-crm_job()
+
+crm_applicant()
diff --git a/addons/crm_hr/crm_hr_data.xml b/addons/crm_hr/crm_hr_data.xml
index 897434987a4..d52a35f5bae 100644
--- a/addons/crm_hr/crm_hr_data.xml
+++ b/addons/crm_hr/crm_hr_data.xml
@@ -8,13 +8,13 @@
Salesman
-
+
Junior Developer
-
+
@@ -22,17 +22,17 @@
Graduate
-
+
Licenced
-
+
> Bac +5
-
+
@@ -40,17 +40,17 @@
Initial Jobs Demand
-
+
First Interview
-
+
Second Interview
-
+
Contract Proposed
@@ -60,17 +60,17 @@
Contract Signed
-
+
Refused by Employee
-
+
Refused by Company
-
+
diff --git a/addons/crm_hr/crm_hr_demo.xml b/addons/crm_hr/crm_hr_demo.xml
index fee80a6c761..4ed75085a1a 100644
--- a/addons/crm_hr/crm_hr_demo.xml
+++ b/addons/crm_hr/crm_hr_demo.xml
@@ -1,12 +1,12 @@
-
-
+
@@ -25,7 +25,7 @@
-
+
@@ -47,7 +47,7 @@
-
+
@@ -67,7 +67,7 @@
-
+
@@ -84,7 +84,7 @@
-
+
@@ -103,7 +103,7 @@
-
+
@@ -121,8 +121,8 @@
-
-
+
+
@@ -144,6 +144,6 @@
-
+
diff --git a/addons/crm_hr/crm_hr_menu.xml b/addons/crm_hr/crm_hr_menu.xml
index dad579f8ef8..0844536a16e 100644
--- a/addons/crm_hr/crm_hr_menu.xml
+++ b/addons/crm_hr/crm_hr_menu.xml
@@ -1,15 +1,15 @@
-
+
######################## JOB OPPORTUNITIES (menu) ###########################
- Jobs Requests
- crm.job
- tree,calendar,form,graph
+ Applicants
+ crm.applicant
+ tree,form,graph
-
+
@@ -18,12 +18,6 @@
-
-
- calendar
-
-
-
form
@@ -39,16 +33,16 @@
+ parent="base.menu_hr"/>-->
+ id="base.menu_crm_case_job_req_main"
+ parent="base.menu_hr"/>
-
+
diff --git a/addons/crm_hr/crm_hr_view.xml b/addons/crm_hr/crm_hr_view.xml
index 9771a25309c..bb3ea95acdc 100644
--- a/addons/crm_hr/crm_hr_view.xml
+++ b/addons/crm_hr/crm_hr_view.xml
@@ -1,29 +1,29 @@
-
+
# ------------------------------------------------------
# Job Categories
# ------------------------------------------------------
- Job Categories
+ Applicant Categories
crm.case.categ
form
-
- [('object_id.model', '=', 'crm.claim')]
- {'object_id':'crm.job'}
+
+ [('object_id.model', '=', 'crm.applicant')]
+ {'object_id':'crm.applicant'}
- # ------------------------------------------------------
+ # ------------------------------------------------------
# Stage
- # ------------------------------------------------------
+ # ------------------------------------------------------
- Job Stages
+ Applicant Stages
crm.case.stage
form
- [('object_id.model', '=', 'crm.claim')]
- {'object_id':'crm.job'}
+ [('object_id.model', '=', 'crm.applicant')]
+ {'object_id':'crm.applicant'}
# ------------------------------------------------------
@@ -31,13 +31,14 @@
# ------------------------------------------------------
- CRM - Jobs Requests Tree
- crm.job
+ Jobs - Recruitment Tree
+ crm.applicant
tree
+
@@ -48,55 +49,48 @@
-
+
-
+
- CRM - Jobs Requests Form
- crm.job
+ Jobs - Recruitment Form
+ crm.applicant
form
-
- CRM - Jobs Requests Calendar
- crm.job
- calendar
-
-
-
-
-
-
-
-
-
- CRM - Jobs Requests Graph
- crm.job
+ Jobs - Recruitment Graph
+ crm.applicant
graph
@@ -199,11 +180,11 @@
-
+
- CRM - Jobs Requests Search
- crm.job
+ Jobs - Recruitment Search
+ crm.applicant
search
@@ -238,12 +219,12 @@
-
+
-
+ domain="[('department_id','=',context.get('department_id',False))]"
+ help="My Department"/>
+
+
diff --git a/addons/crm_hr/crm_hr_wizard.xml b/addons/crm_hr/crm_hr_wizard.xml
index 16b55c5f293..9ae91e62d70 100644
--- a/addons/crm_hr/crm_hr_wizard.xml
+++ b/addons/crm_hr/crm_hr_wizard.xml
@@ -1,29 +1,29 @@
-
+
+ string="Schedule Phone Call" />
+ string="Schedule Meeting"/>
-
+
diff --git a/addons/crm_hr/report/report_crm_hr.py b/addons/crm_hr/report/report_crm_hr.py
index 4560f968769..e35e007300a 100644
--- a/addons/crm_hr/report/report_crm_hr.py
+++ b/addons/crm_hr/report/report_crm_hr.py
@@ -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:
diff --git a/addons/crm_hr/report_crm_hr_view.xml b/addons/crm_hr/report_crm_hr_view.xml
index 7359b6ecade..6c51f03bc8a 100644
--- a/addons/crm_hr/report_crm_hr_view.xml
+++ b/addons/crm_hr/report_crm_hr_view.xml
@@ -6,8 +6,8 @@
-->
- report.crm.job.user.tree
- report.crm.job.user
+ report.crm.applicant.user.tree
+ report.crm.applicant.user
tree
@@ -21,8 +21,8 @@
- report.crm.job.user.form
- report.crm.job.user
+ report.crm.applicant.user.form
+ report.crm.applicant.user
form
@@ -37,8 +37,8 @@
- report.crm.job.user.graph
- report.crm.job.user
+ report.crm.applicant.user.graph
+ report.crm.applicant.user
graph
@@ -50,8 +50,8 @@
- report.crm.job.user.select
- report.crm.job.user
+ report.crm.applicant.user.select
+ report.crm.applicant.user
search
@@ -61,8 +61,8 @@
- Jobs by User and Section
- report.crm.job.user
+ Applicant by User and Section
+ report.crm.applicant.user
form
graph,tree
@@ -73,14 +73,14 @@
name="Reporting"
parent="hr.menu_hr_root"
sequence="40" />
-
+
- report.crm.job.categ.tree
- report.crm.job.categ
+ report.crm.applicant.categ.tree
+ report.crm.applicant.categ
tree
@@ -94,8 +94,8 @@
- report.crm.job.categ.form
- report.crm.job.categ
+ report.crm.applicant.categ.form
+ report.crm.applicant.categ
form
@@ -110,8 +110,8 @@
- report.crm.job.categ.graph
- report.crm.job.categ
+ report.crm.applicant.categ.graph
+ report.crm.applicant.categ
graph
@@ -123,8 +123,8 @@
- report.crm.job.categ.select
- report.crm.job.categ
+ report.crm.applicant.categ.select
+ report.crm.applicant.categ
search
@@ -134,8 +134,8 @@
- Jobs by Categories and Section
- report.crm.job.categ
+ Applicant by Categories and Section
+ report.crm.applicant.categ
form
graph,tree
@@ -146,8 +146,8 @@
- report.crm.job.section.tree
- report.crm.job.section
+ report.crm.applicant.section.tree
+ report.crm.applicant.section
tree
@@ -161,8 +161,8 @@
- report.crm.job.section.graph
- report.crm.job.section
+ report.crm.applicant.section.graph
+ report.crm.applicant.section
graph
@@ -173,8 +173,8 @@
- report.crm.job.section.select
- report.crm.job.section
+ report.crm.applicant.section.select
+ report.crm.applicant.section
search
@@ -184,8 +184,8 @@
- Jobs by Section
- report.crm.job.section
+ Applicant by Section
+ report.crm.applicant.section
form
graph,tree
diff --git a/addons/crm_hr/security/ir.model.access.csv b/addons/crm_hr/security/ir.model.access.csv
index a237d65ad78..6f5dac74dfa 100644
--- a/addons/crm_hr/security/ir.model.access.csv
+++ b/addons/crm_hr/security/ir.model.access.csv
@@ -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
diff --git a/addons/crm_hr/wizard/crm_hr_wizard.py b/addons/crm_hr/wizard/crm_hr_wizard.py
index 66736c5ce47..00a3c967d6e 100644
--- a/addons/crm_hr/wizard/crm_hr_wizard.py
+++ b/addons/crm_hr/wizard/crm_hr_wizard.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
##############################################################################
#
-# OpenERP, Open Source Management Solution
+# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
# $Id$
#
@@ -40,7 +40,7 @@ class job2phonecall(wizard.interface):
-
+
"""
@@ -50,29 +50,30 @@ class job2phonecall(wizard.interface):
'note' : {'string' : 'Goals', 'type' : 'text'},
'category_id' : {'string' : 'Category', 'type' : 'many2one', 'relation' : 'crm.case.categ', 'required' : True},
'section_id' : {'string' : 'Section', 'type' : 'many2one', 'relation' : 'crm.case.section'},
-
+
}
- def _default_values(self, cr, uid, data, context):
- case_obj = pooler.get_pool(cr.dbname).get('crm.job')
- categ_id=pooler.get_pool(cr.dbname).get('crm.case.categ').search(cr, uid, [('name','=','Outbound')])
- case = case_obj.browse(cr, uid, data['id'])
+ def _default_values(self, cr, uid, data, context):
+
+ case_obj = pooler.get_pool(cr.dbname).get('crm.applicant')
+ categ_id=pooler.get_pool(cr.dbname).get('crm.case.categ').search(cr, uid, [('name','=','Outbound')])
+ case = case_obj.browse(cr, uid, data['id'])
return {
'user_id' : case.user_id and case.user_id.id,
- 'category_id' : categ_id and categ_id[0] or case.categ_id and case.categ_id.id,
- 'section_id' : case.section_id and case.section_id.id or False,
+ 'category_id' : categ_id and categ_id[0] or case.categ_id and case.categ_id.id,
+ 'section_id' : case.section_id and case.section_id.id or False,
'note' : case.description
}
def _doIt(self, cr, uid, data, context):
form = data['form']
pool = pooler.get_pool(cr.dbname)
- mod_obj = pool.get('ir.model.data')
+ mod_obj = pool.get('ir.model.data')
result = mod_obj._get_id(cr, uid, 'crm', 'view_crm_case_phonecalls_filter')
res = mod_obj.read(cr, uid, result, ['res_id'])
phonecall_case_obj = pool.get('crm.phonecall')
- job_case_obj = pool.get('crm.job')
+ job_case_obj = pool.get('crm.applicant')
# Select the view
-
+
data_obj = pool.get('ir.model.data')
id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_phone_tree_view')
id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_phone_form_view')
@@ -80,7 +81,7 @@ class job2phonecall(wizard.interface):
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
if id3:
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
-
+
for job in job_case_obj.browse(cr, uid, data['ids']):
#TODO : Take other info from job
new_phonecall_id = phonecall_case_obj.create(cr, uid, {
@@ -88,7 +89,7 @@ class job2phonecall(wizard.interface):
'user_id' : form['user_id'],
'categ_id' : form['category_id'],
'description' : form['note'],
- 'date' : form['deadline'],
+ 'date' : form['deadline'],
'section_id' : form['section_id'],
'description':job.description,
'partner_id':job.partner_id.id,
@@ -105,7 +106,7 @@ class job2phonecall(wizard.interface):
job_case_obj.write(cr, uid, [job.id], vals)
job_case_obj.case_cancel(cr, uid, [job.id])
phonecall_case_obj.case_open(cr, uid, [new_phonecall_id])
- value = {
+ value = {
'name': _('Phone Call'),
'view_type': 'form',
'view_mode': 'tree,form',
@@ -129,14 +130,14 @@ class job2phonecall(wizard.interface):
}
}
-job2phonecall('crm.job.reschedule_phone_call')
+job2phonecall('crm.applicant.reschedule_phone_call')
class job2meeting(wizard.interface):
def _makeMeeting(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
- job_case_obj = pool.get('crm.job')
- meeting_case_obj = pool.get('crm.meeting')
+ job_case_obj = pool.get('crm.applicant')
+ meeting_case_obj = pool.get('crm.meeting')
for job in job_case_obj.browse(cr, uid, data['ids']):
new_meeting_id = meeting_case_obj.create(cr, uid, {
'name': job.name,
@@ -147,8 +148,8 @@ class job2meeting(wizard.interface):
vals = {}
job_case_obj.write(cr, uid, [job.id], vals)
job_case_obj.case_cancel(cr, uid, [job.id])
- meeting_case_obj.case_open(cr, uid, [new_meeting_id])
-
+ meeting_case_obj.case_open(cr, uid, [new_meeting_id])
+
data_obj = pool.get('ir.model.data')
result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_meetings_filter')
id = data_obj.read(cr, uid, result, ['res_id'])
@@ -161,7 +162,7 @@ class job2meeting(wizard.interface):
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
if id3:
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
- return {
+ return {
'name': _('Meetings'),
'view_type': 'form',
'view_mode': 'calendar,form,tree',
@@ -183,7 +184,7 @@ class job2meeting(wizard.interface):
}
}
-job2meeting('crm.job.meeting_set')
+job2meeting('crm.applicant.meeting_set')
class partner_create(wizard.interface):
@@ -201,7 +202,7 @@ class partner_create(wizard.interface):
def _selectPartner(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
- case_obj = pool.get('crm.job')
+ case_obj = pool.get('crm.applicant')
for case in case_obj.browse(cr, uid, data['ids']):
if case.partner_id:
raise wizard.except_wizard(_('Warning !'),
@@ -210,10 +211,10 @@ class partner_create(wizard.interface):
def _makeOrder(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
- mod_obj = pool.get('ir.model.data')
+ mod_obj = pool.get('ir.model.data')
result = mod_obj._get_id(cr, uid, 'base', 'view_res_partner_filter')
res = mod_obj.read(cr, uid, result, ['res_id'])
- case_obj = pool.get('crm.job')
+ case_obj = pool.get('crm.applicant')
partner_obj = pool.get('res.partner')
contact_obj = pool.get('res.partner.address')
for case in case_obj.browse(cr, uid, data['ids']):
@@ -250,7 +251,7 @@ class partner_create(wizard.interface):
'res_id': int(partner_id),
'view_id': False,
'type': 'ir.actions.act_window',
- 'search_view_id': res['res_id']
+ 'search_view_id': res['res_id']
}
return value
@@ -266,7 +267,7 @@ class partner_create(wizard.interface):
}
}
-partner_create('crm.job.partner_create')
+partner_create('crm.applicant.partner_create')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hr/__init__.py b/addons/hr/__init__.py
index 2551ce843d1..b2396739116 100644
--- a/addons/hr/__init__.py
+++ b/addons/hr/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,13 +15,13 @@
# 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 .
+# along with this program. If not, see .
#
##############################################################################
+import hr_department
import hr
import installer
-import hr_department
import report
import wizard
diff --git a/addons/hr/hr.py b/addons/hr/hr.py
index abd9e668a2e..1d816acc2d8 100755
--- a/addons/hr/hr.py
+++ b/addons/hr/hr.py
@@ -61,6 +61,33 @@ class hr_employee_marital_status(osv.osv):
}
hr_employee_marital_status()
+class crm_job(osv.osv):
+
+ def _no_of_employee(self, cr, uid, ids, name,args,context=None):
+ res = {}
+ for emp in self.browse(cr, uid, ids):
+ res[emp.id] = str(len(emp.employee_ids))
+ return res
+
+ _name = "crm.job"
+ _description = "Job Information"
+ _columns = {
+ 'name': fields.char('Name', size=128, required=True, select=True),
+ 'ref': fields.char('Code', size=64),
+ 'expected_employees':fields.integer('Expected Employees'),
+ 'no_of_employee': fields.function(_no_of_employee, method=True, string='No of Employee', type='char'),
+ 'employee_ids':fields.one2many('hr.employee', 'job_id','Employees'),
+ 'description': fields.text('Job Description'),
+ 'requirements':fields.text('Requirements'),
+ 'department_id':fields.many2one('hr.department','Department')
+
+ }
+ _defaults = {
+ 'expected_employees': lambda *a: 1,
+ }
+
+crm_job()
+
class hr_employee(osv.osv):
_name = "hr.employee"
_description = "Employee"
@@ -87,6 +114,9 @@ class hr_employee(osv.osv):
'category_id' : fields.many2one('hr.employee.category', 'Category'),
'child_ids': fields.one2many('hr.employee', 'parent_id','Subordinates'),
'resource_id': fields.many2one('resource.resource','Resource',ondelete='cascade'),
+ 'coach_id':fields.many2one('res.users','Coach'),
+ 'job_id':fields.many2one('crm.job', 'Job'),
+
}
_defaults = {
'active' : lambda *a: True,
@@ -107,4 +137,6 @@ class hr_employee(osv.osv):
]
hr_employee()
+
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hr/hr_department.py b/addons/hr/hr_department.py
index d9efe2ce448..fd3146b33d0 100644
--- a/addons/hr/hr_department.py
+++ b/addons/hr/hr_department.py
@@ -23,9 +23,27 @@ from osv import fields,osv
import tools
class hr_department(osv.osv):
+
+ def name_get(self, cr, uid, ids, context=None):
+ if not len(ids):
+ return []
+ reads = self.read(cr, uid, ids, ['name','parent_id'], context)
+ res = []
+ for record in reads:
+ name = record['name']
+ if record['parent_id']:
+ name = record['parent_id'][1]+' / '+name
+ res.append((record['id'], name))
+ return res
+
+ def _dept_name_get_fnc(self, cr, uid, ids, prop, unknow_none, context):
+ res = self.name_get(cr, uid, ids, context)
+ return dict(res)
+
_name = "hr.department"
_columns = {
'name': fields.char('Department Name', size=64, required=True),
+ 'complete_name': fields.function(_dept_name_get_fnc, method=True, type="char", string='Name'),
'company_id': fields.many2one('res.company', 'Company', select=True, required=True),
'parent_id': fields.many2one('hr.department', 'Parent Department', select=True),
'child_ids': fields.one2many('hr.department', 'parent_id', 'Child Departments'),
@@ -148,4 +166,11 @@ class res_users(osv.osv):
}
res_users()
+#class users(osv.osv):
+# _inherit = 'res.users'
+# _description = "Users"
+# _columns = {
+# 'context_department_id': fields.many2one('hr.department', 'Departments'),
+# }
+#users()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hr/hr_department_view.xml b/addons/hr/hr_department_view.xml
index 80d13dec797..e34c96ec762 100644
--- a/addons/hr/hr_department_view.xml
+++ b/addons/hr/hr_department_view.xml
@@ -37,17 +37,31 @@
child_ids
-
+
+
+ Departments
+ hr.department
+ search
+
+
+
+
+
+
+
+
+
Departments
hr.department
tree
[('parent_id','=',False)]
+
@@ -55,10 +69,51 @@
Departments
hr.department
form
+
-
+
+ res.users.form
+ form
+ res.users
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/hr/hr_view.xml b/addons/hr/hr_view.xml
index cf5f6dd80e6..185fe539af6 100644
--- a/addons/hr/hr_view.xml
+++ b/addons/hr/hr_view.xml
@@ -65,8 +65,9 @@
-
-
+
+
+
@@ -92,6 +93,21 @@
+
+ Employees
+ hr.employee
+ search
+
+
+
+
+
+
+
+
+
+
+
Employees Structure
hr.employee
@@ -99,6 +115,7 @@
tree,form
[('parent_id','=',False)]
+
@@ -107,6 +124,7 @@
form
tree,form
+
+
@@ -279,5 +298,77 @@
+
+ crm.job.form
+ crm.job
+ form
+
+
+
+
+
+ crm.job.tree
+ crm.job
+ tree
+
+
+
+
+
+
+
+
+
+
+
+ Job
+ crm.job
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+ Job
+ crm.job
+ form
+ tree,form
+
+
+
+
+
+
+
+
+
diff --git a/addons/hr_attendance/hr_attendance_view.xml b/addons/hr_attendance/hr_attendance_view.xml
index a39af8cabf4..05cce8b282b 100644
--- a/addons/hr_attendance/hr_attendance_view.xml
+++ b/addons/hr_attendance/hr_attendance_view.xml
@@ -97,7 +97,7 @@
form
-
+
diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py
index 5e71e4614df..e270396d122 100644
--- a/addons/hr_expense/hr_expense.py
+++ b/addons/hr_expense/hr_expense.py
@@ -68,7 +68,8 @@ class hr_expense_expense(osv.osv):
'amount': fields.function(_amount, method=True, string='Total Amount'),
'invoice_id': fields.many2one('account.invoice', 'Invoice'),
'currency_id': fields.many2one('res.currency', 'Currency', required=True),
-
+ 'department_id':fields.many2one('hr.department','Department'),
+ 'company_id': fields.many2one('res.company', 'Company', required=True),
'state': fields.selection([
('draft', 'Draft'),
('confirm', 'Waiting confirmation'),
@@ -85,6 +86,7 @@ class hr_expense_expense(osv.osv):
'employee_id' : _employee_get,
'user_id' : lambda cr,uid,id,c={}: id,
'currency_id': _get_currency,
+ 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
}
def expense_confirm(self, cr, uid, ids, *args):
#for exp in self.browse(cr, uid, ids):
@@ -215,12 +217,12 @@ class hr_expense_line(osv.osv):
if product_id:
product=self.pool.get('product.product').browse(cr,uid,product_id, context=context)
v['name']=product.name
-
+
# Compute based on pricetype of employee company
pricetype_id = self.pool.get('hr.employee').browse(cr,uid,employee_id).user_id.company_id.property_valuation_price_type.id
pricetype=self.pool.get('product.price.type').browse(cr,uid,pricetype_id)
amount_unit=product.price_get(pricetype.field, context)[product.id]
-
+
v['unit_amount']=amount_unit
if not uom_id:
v['uom_id']=product.uom_id.id
diff --git a/addons/hr_expense/hr_expense_view.xml b/addons/hr_expense/hr_expense_view.xml
index 5427aa23063..16828a87a1a 100644
--- a/addons/hr_expense/hr_expense_view.xml
+++ b/addons/hr_expense/hr_expense_view.xml
@@ -29,10 +29,13 @@
+
+
+
@@ -45,10 +48,13 @@
+
+
+
@@ -66,6 +72,8 @@
+
+
@@ -92,7 +100,7 @@
-
+
@@ -145,6 +153,11 @@
domain="[('user_id','=',uid)]"/>
+
+
+
diff --git a/addons/hr_expense/hr_expense_workflow.xml b/addons/hr_expense/hr_expense_workflow.xml
index cbd33ba94aa..57163b6df5f 100644
--- a/addons/hr_expense/hr_expense_workflow.xml
+++ b/addons/hr_expense/hr_expense_workflow.xml
@@ -1,25 +1,25 @@
-
+
-
+
Human Resources - Expenses
-
+
Human Resources - Expenses invoice
-
+
-
+
hr.wkf.expenses
hr.expense.expense
True
-
+
draft
@@ -51,7 +51,7 @@
refused
function
expense_canceled()
- True
+
@@ -60,7 +60,7 @@
action_invoice_create()
-
+
@@ -89,7 +89,7 @@
refuse
-
+
@@ -118,6 +118,11 @@
subflow.cancel
-
+
+
+
+ draft
+
+
diff --git a/addons/hr_holidays/hr.py b/addons/hr_holidays/hr.py
index 8fce5431988..b6c0313e13f 100755
--- a/addons/hr_holidays/hr.py
+++ b/addons/hr_holidays/hr.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
##################################################################################
#
-# Copyright (c) 2005-2006 Axelor SARL. (http://www.axelor.com)
+# Copyright (c) 2005-2006 Axelor SARL. (http://www.axelor.com)
# and 2004-2010 Tiny SPRL ().
#
# $Id: hr.py 4656 2006-11-24 09:58:42Z Cyp $
@@ -37,13 +37,17 @@ class hr_holidays_status(osv.osv):
for record in self.browse(cr, uid, ids, context):
res[record.id] = {}
max_leaves = leaves_taken = 0
+ obj_ids = self.pool.get('hr.holidays.per.user').search(cr, uid, [('user_id','=',uid),('employee_id','=',employee_id),('holiday_status','=',record.id)])
+ if obj_ids:
+ br_ob=self.pool.get('hr.holidays.per.user').browse(cr, uid, obj_ids)[0]
+ max_leaves=br_ob.max_leaves
if not return_false:
cr.execute("""SELECT type, sum(number_of_days) FROM hr_holidays WHERE employee_id = %s AND state='validate' AND holiday_status_id = %s GROUP BY type""", (str(employee_id), str(record.id)))
for line in cr.fetchall():
if line[0] =='remove':
- leaves_taken = -line[1]
+ leaves_taken = -line[1]
if line[0] =='add':
- max_leaves = line[1]
+ max_leaves = line[1]
res[record.id]['max_leaves'] = max_leaves
res[record.id]['leaves_taken'] = leaves_taken
res[record.id]['remaining_leaves'] = max_leaves - leaves_taken
@@ -92,11 +96,11 @@ class hr_holidays_per_user(osv.osv):
result = {}
for holiday_user in self.browse(cr, uid, ids):
days = 0.0
- ids_request = obj_holiday.search(cr, uid, [('employee_id', '=', holiday_user.employee_id.id),('state', '=', 'validate'),('holiday_status', '=', holiday_user.holiday_status.id)])
+ ids_request = obj_holiday.search(cr, uid, [('employee_id', '=', holiday_user.employee_id.id),('state', '=', 'validate'),('holiday_status_id', '=', holiday_user.holiday_status.id)])
if ids_request:
holidays = obj_holiday.browse(cr, uid, ids_request)
for holiday in holidays:
- days += holiday.number_of_days
+ days -= holiday.number_of_days
days = holiday_user.max_leaves - days
result[holiday_user.id] = days
return result
@@ -153,7 +157,8 @@ class hr_holidays(osv.osv):
'allocation_type': fields.selection([('employee','Employee Request'),('company','Company Allocation')], 'Allocation Type', required=True, readonly=True, states={'draft':[('readonly',False)]}, help='This field is only for informative purposes, to depict if the leave request/allocation comes from an employee or from the company'),
'parent_id': fields.many2one('hr.holidays', 'Parent'),
'linked_request_ids': fields.one2many('hr.holidays', 'parent_id', 'Linked Requests',),
- 'holiday_user_id' : fields.many2one('res.users', 'User'),
+ 'holiday_user_id' : fields.many2one('hr.holidays.per.user', 'User'),
+ 'department_id':fields.many2one('hr.department','Department'),
}
_defaults = {
@@ -183,7 +188,7 @@ class hr_holidays(osv.osv):
def _update_user_holidays(self, cr, uid, ids):
for record in self.browse(cr, uid, ids):
if record.state=='validate':
- holiday_id=self.pool.get('hr.holidays.per.user').search(cr, uid, [('employee_id','=', record.employee_id.id),('holiday_status','=',record.holiday_status.id)])
+ holiday_id=self.pool.get('hr.holidays.per.user').search(cr, uid, [('employee_id','=', record.employee_id.id),('holiday_status','=',record.holiday_status_id.id)])
if holiday_id:
obj_holidays_per_user=self.pool.get('hr.holidays.per.user').browse(cr, uid,holiday_id[0])
self.pool.get('hr.holidays.per.user').write(cr,uid,obj_holidays_per_user.id,{'leaves_taken':obj_holidays_per_user.leaves_taken - record.number_of_days})
@@ -193,10 +198,10 @@ class hr_holidays(osv.osv):
_('You can not cancel this holiday request. first You have to make its case in draft state.'))
else:
self.pool.get('crm.case').unlink(cr,uid,[record.case_id.id])
-
+
def _check_date(self, cr, uid, ids):
if ids:
- cr.execute('select number_of_days from hr_holidays where id in ('+','.join(map(str, ids))+')')
+ cr.execute('select number_of_days_temp from hr_holidays where id in ('+','.join(map(str, ids))+')')
res = cr.fetchall()
if res and res[0][0] < 0:
return False
@@ -208,7 +213,7 @@ class hr_holidays(osv.osv):
id_holiday = super(hr_holidays, self).create(cr, uid, vals, *args, **kwargs)
self._create_holiday(cr, uid, [id_holiday])
return id_holiday
-
+
def unlink(self, cr, uid, ids, context={}):
self._update_user_holidays(cr, uid, ids)
return super(hr_holidays, self).unlink(cr, uid, ids, context)
@@ -217,7 +222,7 @@ class hr_holidays(osv.osv):
holidays_user_obj = self.pool.get('hr.holidays.per.user')
holidays_data = self.browse(cr, uid, ids[0])
list_holiday = []
- ids_user_hdays = holidays_user_obj.search(cr, uid, [('employee_id', '=', holidays_data.employee_id.id),('holiday_status', '=', holidays_data.holiday_status.id)])
+ ids_user_hdays = holidays_user_obj.search(cr, uid, [('employee_id', '=', holidays_data.employee_id.id),('holiday_status', '=', holidays_data.holiday_status_id.id)])
for hdays in holidays_user_obj.browse(cr, uid, ids_user_hdays):
for req in hdays.holiday_ids:
list_holiday.append(req.id)
@@ -303,7 +308,7 @@ class hr_holidays(osv.osv):
'company_id':record.employee_id.company_id.id,
'resource_id':record.employee_id.resource_id.id
}
- self.pool.get('resource.calendar.leaves').create(cr,uid,vals)
+ #self.pool.get('resource.calendar.leaves').create(cr,uid,vals)
return True
diff --git a/addons/hr_holidays/hr_holidays_wizard.xml b/addons/hr_holidays/hr_holidays_wizard.xml
index ce5014773b0..fb505d65497 100644
--- a/addons/hr_holidays/hr_holidays_wizard.xml
+++ b/addons/hr_holidays/hr_holidays_wizard.xml
@@ -6,10 +6,15 @@
name="Reporting"
parent="hr.menu_hr_root"
sequence="40" />
+
-
diff --git a/addons/hr_holidays/hr_view.xml b/addons/hr_holidays/hr_view.xml
index 68138977d96..146e06d25a3 100644
--- a/addons/hr_holidays/hr_view.xml
+++ b/addons/hr_holidays/hr_view.xml
@@ -14,16 +14,22 @@
search
-
-
-
+
+
+
+
+
-
+
+
+
+
+
+
-
-
@@ -49,6 +55,7 @@
+
@@ -76,6 +83,7 @@
+
@@ -107,6 +115,7 @@
+
@@ -138,27 +147,49 @@
+
-
+
-
+
hr.holidays.per.user.form
hr.holidays.per.user
- tree
+ form
-
+
+
+
+
+
+ hr.holidays.per.user.tree
+ hr.holidays.per.user
+ tree
+
+
+
+
+
+
+
+
+
+
@@ -289,5 +320,18 @@
view_id ="eval('edit_holiday_new')"
id="act_hr_employee_holiday_request"/>
+
+ Holiday Per User
+ hr.holidays.per.user
+ form
+ tree,form
+
+
+
+
+
diff --git a/addons/hr_timesheet/hr_timesheet_report.xml b/addons/hr_timesheet/hr_timesheet_report.xml
index 4f6c32bbdce..9b7c527fea9 100644
--- a/addons/hr_timesheet/hr_timesheet_report.xml
+++ b/addons/hr_timesheet/hr_timesheet_report.xml
@@ -6,6 +6,11 @@
name="Reporting"
parent="hr.menu_hr_root"
sequence="40" />
+
@@ -13,7 +18,7 @@
-
@@ -21,7 +26,7 @@
@@ -33,7 +38,7 @@
action="wizard_hr_timesheet_users"
id="menu_wizard_hr_timesheet_users"
groups="hr.group_hr_manager"
- parent="hr.menu_hr_reporting" type="wizard"/>
+ parent="menu_hr_reporting_timesheet" type="wizard"/>
diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml b/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml
index 4b6f2c3d91d..5db8bfeb921 100644
--- a/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml
+++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml
@@ -6,6 +6,11 @@
name="Reporting"
parent="hr.menu_hr_root"
sequence="40" />
+
@@ -29,7 +34,7 @@
diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
index 81b5e99d1f5..a738ee55ace 100644
--- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
+++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
@@ -246,6 +246,7 @@ class hr_timesheet_sheet(osv.osv):
'period_ids': fields.one2many('hr_timesheet_sheet.sheet.day', 'sheet_id', 'Period', readonly=True),
'account_ids': fields.one2many('hr_timesheet_sheet.sheet.account', 'sheet_id', 'Analytic accounts', readonly=True),
'company_id': fields.many2one('res.company', 'Company'),
+ 'department_id':fields.many2one('hr.department','Department'),
}
def _default_date_from(self,cr, uid, context={}):
diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml
index e47662152c2..ef1df892668 100644
--- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml
+++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml
@@ -8,6 +8,7 @@
+
@@ -27,6 +28,7 @@
+
@@ -107,6 +109,7 @@
+
@@ -194,10 +197,7 @@
search
-
-
-
-
+
@@ -205,7 +205,14 @@
-
+
+
+
+
+
+
diff --git a/addons/resource/hr_demo.xml b/addons/resource/hr_demo.xml
deleted file mode 100755
index fc01109d86c..00000000000
--- a/addons/resource/hr_demo.xml
+++ /dev/null
@@ -1,90 +0,0 @@
-
-
-
-
-
-
-
- 38 Hours/Week
-
-
-
- Fabien Pinckaers
-
-
-
-
-
-
- Monday morning
- 0
- 08
- 12
-
-
-
- Monday evening
- 0
- 13
- 18
-
-
-
- Tuesday morning
- 1
- 08
- 12
-
-
-
- Tuesday evening
- 1
- 13
- 18
-
-
-
- Wednesday morning
- 2
- 08
- 12
-
-
-
- Wednesday evening
- 2
- 13
- 18
-
-
-
- Thursday morning
- 3
- 08
- 12
-
-
-
- Thursday evening
- 13
- 18
- 3
-
-
-
- Friday morning
- 4
- 08
- 12
-
-
-
- Friday evening
- 4
- 13
- 18
-
-
-
-
-
diff --git a/addons/resource/hr_department.py b/addons/resource/hr_department.py
deleted file mode 100755
index 907bc55a435..00000000000
--- a/addons/resource/hr_department.py
+++ /dev/null
@@ -1,153 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 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 hr_department(osv.osv):
- _name = "hr.department"
- _columns = {
- 'name': fields.char('Department Name', size=64, required=True),
- 'company_id': fields.many2one('res.company', 'Company', select=True, required=True),
- 'parent_id': fields.many2one('hr.department', 'Parent Department', select=True),
- 'child_ids': fields.one2many('hr.department', 'parent_id', 'Child Departments'),
- 'note': fields.text('Note'),
- 'manager_id': fields.many2one('res.users', 'Manager', required=True),
- 'member_ids': fields.many2many('res.users', 'hr_department_user_rel', 'department_id', 'user_id', 'Members'),
- }
- def _get_members(self,cr, uid, context={}):
- mids = self.search(cr, uid, [('manager_id','=',uid)])
- result = {uid:1}
- for m in self.browse(cr, uid, mids, context):
- for user in m.member_ids:
- result[user.id] = 1
- return result.keys()
- def _check_recursion(self, cr, uid, ids):
- level = 100
- while len(ids):
- cr.execute('select distinct parent_id from hr_department where id in ('+','.join(map(str, ids))+')')
- ids = filter(None, map(lambda x:x[0], cr.fetchall()))
- if not level:
- return False
- level -= 1
- return True
-
- _constraints = [
- (_check_recursion, 'Error! You can not create recursive departments.', ['parent_id'])
- ]
-
-hr_department()
-
-
-class ir_action_window(osv.osv):
- _inherit = 'ir.actions.act_window'
-
- def read(self, cr, uid, ids, fields=None, context=None,
- load='_classic_read'):
- select = ids
- if isinstance(ids, (int, long)):
- select = [ids]
- res = super(ir_action_window, self).read(cr, uid, select, fields=fields,
- context=context, load=load)
- for r in res:
- mystring = 'department_users_get()'
- if mystring in (r.get('domain', '[]') or ''):
- r['domain'] = r['domain'].replace(mystring, str(
- self.pool.get('hr.department')._get_members(cr, uid)))
- if isinstance(ids, (int, long)):
- if res:
- return res[0]
- else:
- return False
- return res
-
-ir_action_window()
-
-class res_users(osv.osv):
- _inherit = 'res.users'
- _description = 'res.users'
-
- def _parent_compute(self, cr, uid, ids, name, args, context={}):
- result = {}
- obj_dept = self.pool.get('hr.department')
- for user_id in ids:
- ids_dept = obj_dept.search(cr, uid, [('member_ids', 'in', [user_id])])
- parent_ids = []
- if ids_dept:
- data_dept = obj_dept.read(cr, uid, ids_dept, ['manager_id'])
- parent_ids = map(lambda x: x['manager_id'][0], data_dept)
- result[user_id] = parent_ids
- return result
-
- def _parent_search(self, cr, uid, obj, name, args):
- parent = []
- for arg in args:
- if arg[0] == 'parent_id':
- parent = arg[2]
- child_ids = self._child_compute(cr, uid, parent,name, args, {})
- if not child_ids:
- return [('id', 'in', [0])]
- return [('id', 'in', child_ids.get(uid,[]))]
-
- def _child_compute(self, cr, uid, ids, name, args, context={}):
- obj_dept = self.pool.get('hr.department')
- obj_user = self.pool.get('res.users')
- result = {}
- for manager_id in ids:
- child_ids = []
- mgnt_dept_ids = obj_dept.search(cr, uid, [('manager_id', '=', manager_id)])
- ids_dept = obj_dept.search(cr, uid, [('id', 'child_of', mgnt_dept_ids)])
- if ids_dept:
- data_dept = obj_dept.read(cr, uid, ids_dept, ['member_ids'])
- childs = map(lambda x: x['member_ids'], data_dept)
- childs = tools.flatten(childs)
- childs = obj_user.search(cr, uid, [('id','in',childs),('active','=',True)])
- if manager_id in childs:
- childs.remove(manager_id)
-
- child_ids.extend(tools.flatten(childs))
- set = {}
- map(set.__setitem__, child_ids, [])
- child_ids = set.keys()
- else:
- child_ids = []
- result[manager_id] = child_ids
- return result
-
- def _child_search(self, cr, uid, obj, name, args):
- parent = []
- for arg in args:
- if arg[0] == 'child_ids':
- parent = arg[2]
- child_ids = self._child_compute(cr, uid, parent,name, args, {})
- if not child_ids:
- return [('id', 'in', [0])]
- return [('id', 'in', child_ids.get(uid,[]))]
-
- _columns = {
- 'parent_id': fields.function(_parent_compute, relation='res.users',fnct_search=_parent_search, method=True, string="Managers", type='many2many'),
- 'child_ids': fields.function(_child_compute, relation='res.users', fnct_search=_child_search,method=True, string="Subordinates", type='many2many'),
- }
-
-
-res_users()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/resource/hr_department_demo.xml b/addons/resource/hr_department_demo.xml
deleted file mode 100755
index c7ea68f1dc3..00000000000
--- a/addons/resource/hr_department_demo.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
-
-
- Management
-
-
-
-
- Administration
-
-
-
-
-
-
- Technical department
-
-
-
-
-
-
- IT
-
-
-
-
-
-
- Marketing
-
-
-
-
-
-
- Sales
-
-
-
-
-
-
- Sales Europe
-
-
-
-
-
-
- Sales America
-
-
-
-
-
-
-
-
-
-
diff --git a/addons/resource/hr_department_view.xml b/addons/resource/hr_department_view.xml
deleted file mode 100755
index fe65d988237..00000000000
--- a/addons/resource/hr_department_view.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
-
-
-
-
- hr.department.form
- hr.department
- form
-
-
-
-
-
- hr.department.tree
- hr.department
- tree
- child_ids
-
-
-
-
-
-
-
-
-
- Departments
- hr.department
- tree
- [('parent_id','=',False)]
-
-
-
-
- Departments
- hr.department
- form
-
-
-
-
-
-
- res.users.form
- form
- res.users
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/addons/resource/hr_view.xml b/addons/resource/hr_view.xml
deleted file mode 100755
index c0fc3c54ffd..00000000000
--- a/addons/resource/hr_view.xml
+++ /dev/null
@@ -1,296 +0,0 @@
-
-
-
-
-
-
-
-
-
- hr.employee.form
- hr.employee
- form
-
-
-
-
-
-
- hr.employee.tree
- hr.employee
- tree
- child_ids
-
-
-
-
-
-
-
-
-
-
-
- Employees Structure
- hr.employee
- tree
- tree,form
-
- [('parent_id','=',False)]
-
-
-
- Employees
- hr.employee
- form
- tree,form
-
-
-
-
-
-
-
- All Employees
- hr.employee
- form
- tree,form
- []
-
-
-
-
-
- hr.employee.tree
- hr.employee
- tree
- child_ids
-
-
-
-
-
-
-
-
-
-
- Employee Hierarchy
- ir.actions.act_window
- hr.employee
- [('id','in',active_ids)]
- tree
-
-
-
-
-
-
- Employees Hierarchy
-
-
-
-
-
-
-
-
- resource.calendar.form
- resource.calendar
- form
-
-
-
-
-
- Working Time Categories
- resource.calendar
- form
-
-
-
-
-
- resource.calendar.week.tree
- resource.calendar.week
- tree
-
-
-
-
-
-
-
-
-
-
- resource.calendar.week.form
- resource.calendar.week
- form
-
-
-
-
-
-
-
-
- hr.employee.category.form
- hr.employee.category
- form
-
-
-
-
-
- hr.employee.category.list
- hr.employee.category
- tree
-
-
-
-
-
-
-
-
-
- hr.employee.category.tree
- hr.employee.category
- tree
- child_ids
-
-
-
-
-
-
-
- Categories of Employee
- hr.employee.category
- form
- tree,form
-
-
-
-
- Categories structure
- hr.employee.category
- tree
-
- [('parent_id','=',False)]
-
-
-
- Employees
- ir.actions.act_window
- hr.employee
- form
- tree,form
- [('category_id','child_of',[active_id])]
- {'category_id':active_id}
-
-
-
-
-
- Employees by Categories
-
-
-
-
-
-
-
-