From b15c331db0f323328e9dd90af899c5ef9deb412c Mon Sep 17 00:00:00 2001 From: "Vir (Open ERP)" Date: Wed, 17 Feb 2010 10:55:53 +0530 Subject: [PATCH 01/15] [IMP] HR : Employee,Department search view added. coach_id added in employee. Full name display in department object. bzr revid: vir@tinyerp.com-20100217052553-sefa7ohcui06vnst --- addons/hr/hr.py | 1 + addons/hr/hr_department.py | 25 +++++++++++++ addons/hr/hr_department_view.xml | 41 ++++++++++++++++++++- addons/hr/hr_view.xml | 27 +++++++++++--- addons/hr_attendance/hr_attendance_view.xml | 2 +- addons/hr_expense/hr_expense.py | 6 +-- addons/hr_expense/hr_expense_view.xml | 3 ++ 7 files changed, 95 insertions(+), 10 deletions(-) diff --git a/addons/hr/hr.py b/addons/hr/hr.py index d3f4da23475..16c99c35eac 100755 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -85,6 +85,7 @@ 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'), } _defaults = { 'active' : lambda *a: True, diff --git a/addons/hr/hr_department.py b/addons/hr/hr_department.py index d9efe2ce448..f63bc7c40e9 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 department(osv.osv): + _inherit = 'res.users' + _description = "Users" + _columns = { + 'context_department_id': fields.many2one('hr.department', 'Departments'), + } +department() # 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..4a268f25b11 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,35 @@ Departments hr.department form + + + view.department.form.hr.inherited1 + res.users + + form + + + + + + + + + view.department.form.hr.inherited2 + res.users + form + + + + + + + + diff --git a/addons/hr/hr_view.xml b/addons/hr/hr_view.xml index 773697c62cd..e770052d620 100644 --- a/addons/hr/hr_view.xml +++ b/addons/hr/hr_view.xml @@ -64,7 +64,7 @@ - + @@ -91,6 +91,20 @@ + + Employees + hr.employee + search + + + + + + + + + + Employees Structure hr.employee @@ -98,6 +112,7 @@ tree,form [('parent_id','=',False)] + @@ -106,6 +121,7 @@ form tree,form + From ddfcd4042362d651b7b3f10c3417809fa1751a96 Mon Sep 17 00:00:00 2001 From: "Vir (Open ERP)" Date: Wed, 17 Feb 2010 14:19:38 +0530 Subject: [PATCH 03/15] [IMP] department_id added in expense,timesheet,applicant,holidays. Department view put in comment in resource and set in hr bzr revid: vir@tinyerp.com-20100217084938-wb9ixv8ey4ah6j9i --- addons/crm_hr/crm_hr.py | 15 +++++------ addons/crm_hr/crm_hr_view.xml | 25 ++++++++++--------- addons/hr/hr_department_view.xml | 16 ++++++++++++ addons/hr_holidays/hr.py | 8 +++--- addons/hr_holidays/hr_view.xml | 4 +++ .../hr_timesheet_sheet/hr_timesheet_sheet.py | 1 + .../hr_timesheet_sheet_view.xml | 3 +++ addons/resource/hr_department_view.xml | 4 +-- 8 files changed, 52 insertions(+), 24 deletions(-) diff --git a/addons/crm_hr/crm_hr.py b/addons/crm_hr/crm_hr.py index b122cc6b9e9..2abed71561f 100644 --- a/addons/crm_hr/crm_hr.py +++ b/addons/crm_hr/crm_hr.py @@ -26,18 +26,18 @@ class crm_job(osv.osv): _name = "crm.job" _description = "Job 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'), + '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')]"), '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), + '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')]"), 'duration': fields.float('Duration'), @@ -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() diff --git a/addons/crm_hr/crm_hr_view.xml b/addons/crm_hr/crm_hr_view.xml index 9771a25309c..41f31883d18 100644 --- a/addons/crm_hr/crm_hr_view.xml +++ b/addons/crm_hr/crm_hr_view.xml @@ -1,7 +1,7 @@ - + # ------------------------------------------------------ # Job Categories # ------------------------------------------------------ @@ -10,20 +10,20 @@ Job Categories crm.case.categ form - + [('object_id.model', '=', 'crm.claim')] - {'object_id':'crm.job'} + {'object_id':'crm.job'} - # ------------------------------------------------------ + # ------------------------------------------------------ # Stage - # ------------------------------------------------------ + # ------------------------------------------------------ Job Stages crm.case.stage form [('object_id.model', '=', 'crm.claim')] - {'object_id':'crm.job'} + {'object_id':'crm.job'} # ------------------------------------------------------ @@ -38,6 +38,7 @@ + @@ -48,9 +49,9 @@