diff --git a/addons/board_hr/__terp__.py b/addons/board_hr/__terp__.py index 182cd36e1ec..937f4e72c32 100644 --- a/addons/board_hr/__terp__.py +++ b/addons/board_hr/__terp__.py @@ -31,7 +31,7 @@ This module implements a dashboard for human resource management that includes: * My Expenses """, 'author': 'Tiny', - 'depends': [ 'crm_project','board','hr_expense','hr_timesheet_sheet','hr_holidays' + 'depends': [ 'project_issue','board','hr_expense','hr_timesheet_sheet','hr_holidays' ], 'update_xml': ['board_hr_view.xml'], 'demo_xml': [], diff --git a/addons/board_project/__terp__.py b/addons/board_project/__terp__.py index c2667fd113a..92a8aeb1518 100644 --- a/addons/board_project/__terp__.py +++ b/addons/board_project/__terp__.py @@ -40,7 +40,7 @@ This module implements a dashboard for project member that includes: 'report_analytic_line', 'report_task', 'hr_timesheet_sheet', - 'crm_project', + 'project_issue', 'resource' ], 'update_xml': ['board_project_view.xml', 'board_project_manager_view.xml'], diff --git a/addons/board_project/board_project_view.xml b/addons/board_project/board_project_view.xml index e602b54d982..19cdb3a6a1b 100644 --- a/addons/board_project/board_project_view.xml +++ b/addons/board_project/board_project_view.xml @@ -80,7 +80,7 @@ form tree,form [('resource_type','=','user')] - + @@ -92,7 +92,7 @@ - + diff --git a/addons/crm_project/crm_feature_menu.xml b/addons/crm_project/crm_feature_menu.xml deleted file mode 100644 index 1e3e8a5a915..00000000000 --- a/addons/crm_project/crm_feature_menu.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - ######################## Future Request (menu) ########################### - - - Future Requests - crm.project.bug - form - tree,calendar - - - - - - - tree - - - - - - calendar - - - - - - form - - - - - - - diff --git a/addons/crm_project/crm_report_project_bug_view.xml b/addons/crm_project/crm_report_project_bug_view.xml deleted file mode 100644 index 1bd6c7f547e..00000000000 --- a/addons/crm_project/crm_report_project_bug_view.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - crm.project.bug.report.tree - crm.project.bug.report - tree - - - - - - - - - - - - - - - - - - - crm.project.bug.report.form - crm.project.bug.report - - form - - - - - - - - - - - - - crm.project.bug.report.graph - crm.project.bug.report - graph - - - - - - - - - - - crm.project.bug.report.select - crm.project.bug.report - - search - - - - - - - - - Project Bug - crm.project.bug.report - form - graph,tree - - - - - - - - tree - - - - - - graph - - - - - - - - diff --git a/addons/crm_project/security/crm_project_security.xml b/addons/crm_project/security/crm_project_security.xml deleted file mode 100644 index 5789be5d41d..00000000000 --- a/addons/crm_project/security/crm_project_security.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - crm.project.bug.rule.group - - - - - ['|',('project_id','=',False),('project_id','=',user.context_project_id)] - - - - - diff --git a/addons/crm_project/security/ir.model.access.csv b/addons/crm_project/security/ir.model.access.csv deleted file mode 100644 index e483f2ccc20..00000000000 --- a/addons/crm_project/security/ir.model.access.csv +++ /dev/null @@ -1,3 +0,0 @@ -"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" -"access_crm_project_bug","crm.project.bug","model_crm_project_bug","crm.group_crm_manager",1,1,1,1 -"access_report_crm_project_bug","report.crm.project.bug","model_report_crm_project_bug","crm.group_crm_manager",1,0,0,0 diff --git a/addons/hr_evaluation/hr_evaluation.py b/addons/hr_evaluation/hr_evaluation.py index 6b2b17344d8..6c782a32d02 100644 --- a/addons/hr_evaluation/hr_evaluation.py +++ b/addons/hr_evaluation/hr_evaluation.py @@ -22,6 +22,8 @@ import time from osv import fields, osv from mx import DateTime as dt +import tools +from tools.translate import _ class hr_evaluation_plan(osv.osv): _name = "hr_evaluation.plan" @@ -76,9 +78,9 @@ class hr_employee(osv.osv): _inherit="hr.employee" _columns = { 'evaluation_plan_id': fields.many2one('hr_evaluation.plan', 'Evaluation Plan'), - 'evaluation_date': fields.date('Next Evaluation', help="Date of the next evaluation",readonly=True), + 'evaluation_date': fields.date('Next Evaluation', help="Date of the next evaluation"), } - + def onchange_evaluation_plan_id(self,cr,uid,ids,evaluation_plan_id,context={}): evaluation_date = self.browse(cr, uid, ids)[0].evaluation_date or '' evaluation_plan_obj=self.pool.get('hr_evaluation.plan') @@ -91,21 +93,6 @@ class hr_employee(osv.osv): return {'value': {'evaluation_date':evaluation_date}} hr_employee() -class hr_evaluation_interview(osv.osv): - _name = "hr.evaluation.interview" - _inherit = "survey.request" - - def default_get(self, cr, uid, fields, context={}): - data = super(hr_evaluation_interview, self).default_get(cr, uid, fields, context) - if context.has_key('phase_id'): - data['survey_id'] =self.pool.get('hr_evaluation.plan.phase').browse(cr, uid, context['phase_id']).survey_id.id - return data - - _columns = { - 'user_to_review_id': fields.many2one('hr.employee', 'Employee'), - } -hr_evaluation_interview() - class hr_evaluation(osv.osv): _name = "hr_evaluation.evaluation" _description = "Employee Evaluation" @@ -124,11 +111,7 @@ class hr_evaluation(osv.osv): ('3','Exceeds expectations'), ('4','Significantly exceeds expectations'), ], "Overall Rating", help="This is the overall rating on that summarize the evaluation"), - 'survey_request_ids': fields.many2many('hr.evaluation.interview', - 'hr_evaluation_evaluation_requests', - 'evaluation_id', - 'survey_id', - 'Appraisal Forms'), + 'survey_request_ids': fields.one2many('hr.evaluation.interview','evaluation_id','Appraisal Forms'), 'plan_id': fields.many2one('hr_evaluation.plan', 'Plan', required=True), 'state': fields.selection([ ('draft','Draft'), @@ -137,19 +120,80 @@ class hr_evaluation(osv.osv): ('done','Done'), ('cancel','Cancelled'), ], 'State', required=True,readonly=True), - 'date_close': fields.date('Ending Date') + 'date_close': fields.date('Ending Date'), + 'progress' : fields.float("Progress"), } _defaults = { - 'date' : lambda *a: time.strftime('%Y-%m-%d'), + 'date' : lambda *a: (dt.ISO.ParseAny(dt.now().strftime('%Y-%m-%d')) + dt.RelativeDateTime(months =+ 1)).strftime('%Y-%m-%d'), 'state' : lambda *a: 'draft', } + def onchange_employee_id(self,cr,uid,ids,employee_id,context={}): + employee_obj=self.pool.get('hr.employee') + evaluation_plan_id='' + if employee_id: + for employee in employee_obj.browse(cr,uid,[employee_id]): + if employee and employee.evaluation_plan_id and employee.evaluation_plan_id.id: + evaluation_plan_id=employee.evaluation_plan_id.id + employee_ids=employee_obj.search(cr,uid,[('parent_id','=',employee.id)]) + return {'value': {'plan_id':evaluation_plan_id}} + def button_plan_in_progress(self,cr, uid, ids, context): + employee_obj = self.pool.get('hr.employee') + hr_eval_inter_obj = self.pool.get('hr.evaluation.interview') + survey_request_obj = self.pool.get('survey.request') + curr_employee=self.browse(cr,uid, ids)[0].employee_id + child_employees=employee_obj.browse(cr,uid, employee_obj.search(cr,uid,[('parent_id','=',curr_employee.id)])) + manager_employee=curr_employee.parent_id + for evaluation in self.browse(cr,uid,ids): + if evaluation and evaluation.plan_id: + apprai_id = [] + for phase in evaluation.plan_id.phase_ids: + if phase.action == "bottom-up": + for child in child_employees: + if child.user_id: + user = child.user_id.id + id = hr_eval_inter_obj.create(cr, uid, {'evaluation_id':evaluation.id ,'user_id' : user,'survey_id' : phase.survey_id.id, 'user_to_review_id' : child.id, 'date_deadline' :(dt.ISO.ParseAny(dt.now().strftime('%Y-%m-%d')) + dt.RelativeDateTime(months =+ 1)).strftime('%Y-%m-%d')}) + if not phase.wait: + hr_eval_inter_obj.survey_req_waiting_answer(cr, uid, [id], context) + apprai_id.append(id) + elif phase.action == "top-down": + if manager_employee: + user = False + if manager_employee.user_id: + user = manager_employee.user_id.id + id = hr_eval_inter_obj.create(cr, uid, {'evaluation_id':evaluation.id,'user_id': user ,'survey_id' : phase.survey_id.id, 'user_to_review_id' :manager_employee.id, 'date_deadline' :(dt.ISO.ParseAny(dt.now().strftime('%Y-%m-%d')) + dt.RelativeDateTime(months =+ 1)).strftime('%Y-%m-%d')}) + if not phase.wait: + hr_eval_inter_obj.survey_req_waiting_answer(cr, uid, [id], context) + apprai_id.append(id) + elif phase.action == "self": + if curr_employee: + user = False + if curr_employee.user_id: + user = curr_employee.user_id.id + id = hr_eval_inter_obj.create(cr, uid, {'evaluation_id':evaluation.id,'user_id' : user, 'survey_id' : phase.survey_id.id, 'user_to_review_id' :curr_employee.id, 'date_deadline' :(dt.ISO.ParseAny(dt.now().strftime('%Y-%m-%d')) + dt.RelativeDateTime(months =+ 1)).strftime('%Y-%m-%d')}) + if not phase.wait: + hr_eval_inter_obj.survey_req_waiting_answer(cr, uid, [id], context) + apprai_id.append(id) + elif phase.action == "final": + if manager_employee: + user = False + if manager_employee.user_id: + user = manager_employee.user_id.id + id = hr_eval_inter_obj.create(cr, uid, {'evaluation_id':evaluation.id,'user_id' : user, 'survey_id' : phase.survey_id.id, 'user_to_review_id' :manager_employee.id, 'date_deadline' :(dt.ISO.ParseAny(dt.now().strftime('%Y-%m-%d')) + dt.RelativeDateTime(months =+ 1)).strftime('%Y-%m-%d')}) + if not phase.wait: + hr_eval_inter_obj.survey_req_waiting_answer(cr, uid, [id], context) + apprai_id.append(id) + self.write(cr, uid, evaluation.id, {'survey_request_ids':[[6, 0, apprai_id]]}) self.write(cr,uid,ids,{'state':'wait'}) return True def button_final_validation(self,cr, uid, ids, context): self.write(cr,uid,ids,{'state':'progress'}) + request_obj = self.pool.get('hr.evaluation.interview') + for id in self.browse(cr, uid ,ids): + if len(id.survey_request_ids) != len(request_obj.search(cr, uid, [('evaluation_id', '=', id.id),('state', '=', 'done')])): + raise osv.except_osv(_('Warning !'),_("You cannot change state, because some appraisal in waiting answer or draft state")) return True def button_done(self,cr, uid, ids, context): @@ -162,3 +206,63 @@ class hr_evaluation(osv.osv): hr_evaluation() +class survey_request(osv.osv): + _inherit="survey.request" + _columns = { + 'is_evaluation':fields.boolean('Is Evaluation?'), + } +survey_request() + +class hr_evaluation_interview(osv.osv): + _name='hr.evaluation.interview' + _inherits={'survey.request':'request_id'} + _description='Evaluation Interview' + _columns = { + + 'request_id': fields.many2one('survey.request','Request_id', ondelete='cascade'), + 'user_to_review_id': fields.many2one('hr.employee', 'Employee'), + 'evaluation_id' : fields.many2one('hr_evaluation.evaluation', 'Evaluation'), + } + _defaults = { + 'is_evaluation': lambda *a: True, + } + + def survey_req_waiting_answer(self, cr, uid, ids, context): + self.write(cr, uid, ids, { 'state' : 'waiting_answer'}) +# for id in self.browse(cr, uid, ids): +# if id.user_id and id.user_id.address_id and id.user_id.address_id and id.user_id.address_id.email: +# msg = " Hello %s, \n\n We are inviting you for %s survey. \n\n Thanks," %(id.user_id.name, id.survey_id.title) +# tools.email_send(tools.config['email_from'], [id.user_id.address_id.email],\ +# 'Invite to fill up Survey', msg) + return True + + def survey_req_done(self, cr, uid, ids, context): + self.write(cr, uid, ids, { 'state' : 'done'}) + hr_eval_obj = self.pool.get('hr_evaluation.evaluation') + for id in self.browse(cr, uid, ids): + flag = False + wating_id = 0 + tot_done_req = 0 + records = self.pool.get("hr_evaluation.evaluation").browse(cr, uid, [id.evaluation_id.id])[0].survey_request_ids + for child in records: + if child.state == "draft" : + wating_id = child.id + continue + if child.state != "done": + flag = True + else : + tot_done_req += 1 + if not flag and wating_id: + self.survey_req_waiting_answer(cr, uid, [wating_id], context) + hr_eval_obj.write(cr, uid, [id.evaluation_id.id], {'progress' :tot_done_req * 100 / len(records)}) + + return True + def survey_req_draft(self, cr, uid, ids, arg): + self.write(cr, uid, ids, { 'state' : 'draft'}) + return True + + def survey_req_cancel(self, cr, uid, ids, context): + self.write(cr, uid, ids, { 'state' : 'cancel'}) + return True + +hr_evaluation_interview() \ No newline at end of file diff --git a/addons/hr_evaluation/hr_evaluation_data.xml b/addons/hr_evaluation/hr_evaluation_data.xml index 372b40a95f7..2064d18f121 100644 --- a/addons/hr_evaluation/hr_evaluation_data.xml +++ b/addons/hr_evaluation/hr_evaluation_data.xml @@ -1499,15 +1499,15 @@ Once the form had been filled, the employee send it to his supervisor. - - - waiting_answer - - - fp@tinyerp.com - 2010-02-21 - - + + + + + + + + + @@ -1578,27 +1578,27 @@ Once the form had been filled, the employee send it to his supervisor. - - - waiting_answer - - - fp@tinyerp.com - 2010-02-21 - - - - - 0 - - - draft - - 2010-01-21 - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/addons/hr_evaluation/hr_evaluation_view.xml b/addons/hr_evaluation/hr_evaluation_view.xml index 08ac9615ef2..2783c95521c 100644 --- a/addons/hr_evaluation/hr_evaluation_view.xml +++ b/addons/hr_evaluation/hr_evaluation_view.xml @@ -44,7 +44,7 @@ @@ -63,7 +63,7 @@ - + @@ -93,7 +93,7 @@ - + @@ -121,9 +121,10 @@
- + + @@ -173,36 +174,57 @@ - + + + + hr_evaluation.evaluation_search + hr_evaluation.evaluation + search + + + + + + + + + + + + + + + + hr_evaluation.evaluation form tree,form + - - + hr_evaluation.interview.form hr.evaluation.interview form - + - +