diff options
| author | atp (Open ERP) <atp@tinyerp.co.in> | 2010-06-22 10:45:44 +0530 |
|---|---|---|
| committer | atp (Open ERP) <atp@tinyerp.co.in> | 2010-06-22 10:45:44 +0530 |
| commit | b0efd26edd9f4e2aa75424b787ea46d2be15cd04 (patch) | |
| tree | e78cdb693e62a5c9a17f77a395eec51fb34becbf /addons/hr_evaluation | |
| parent | 46bb1ea51be702758d68a5f69db32c82dbccf9bd (diff) | |
| parent | 2319190c5a20cb8095f85cacca89a33164ba93d7 (diff) | |
[MERGE]: merge with lp:~openerp-dev/openobject-addons/trunk-dev-addons2
bzr revid: atp@tinyerp.co.in-20100622051544-c7hig73zk2at66cy
Diffstat (limited to 'addons/hr_evaluation')
| -rw-r--r-- | addons/hr_evaluation/__openerp__.py | 6 | ||||
| -rw-r--r-- | addons/hr_evaluation/board_hr_evaluation_view.xml | 26 | ||||
| -rw-r--r-- | addons/hr_evaluation/hr_evaluation.py | 40 | ||||
| -rw-r--r-- | addons/hr_evaluation/hr_evaluation_view.xml | 2 | ||||
| -rw-r--r-- | addons/hr_evaluation/report/hr_evaluation_report.py | 2 | ||||
| -rw-r--r-- | addons/hr_evaluation/report/hr_evaluation_report_view.xml | 2 | ||||
| -rw-r--r-- | addons/hr_evaluation/test/test_hr_evaluation.yml | 152 |
7 files changed, 205 insertions, 25 deletions
diff --git a/addons/hr_evaluation/__openerp__.py b/addons/hr_evaluation/__openerp__.py index 36b54b63d0b..84d4ea61b57 100644 --- a/addons/hr_evaluation/__openerp__.py +++ b/addons/hr_evaluation/__openerp__.py @@ -33,14 +33,16 @@ in which various surveys can be created and it can be defined which level of employee hierarchy fills what and final review and evaluation is done by the manager.Every evaluation filled by the employees can be viewed - in the form of """, + in the form of.Implements a dashboard for My Current Evaluations """, "init_xml" : [], - "demo_xml" : ["hr_evaluation_demo.xml"], + "demo_xml" : ["hr_evaluation_demo.xml", + ], "update_xml" : [ "security/ir.model.access.csv", "wizard/hr_evaluation_mail_view.xml", "hr_evaluation_view.xml", "report/hr_evaluation_report_view.xml"], + "test": ["test/test_hr_evaluation.yml"], "active": False, "installable": True } diff --git a/addons/hr_evaluation/board_hr_evaluation_view.xml b/addons/hr_evaluation/board_hr_evaluation_view.xml new file mode 100644 index 00000000000..7822c0d3111 --- /dev/null +++ b/addons/hr_evaluation/board_hr_evaluation_view.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + <record id="act_hr_evaluation_tree" model="ir.actions.act_window"> + <field name="name">My Current Evaluations</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">hr_evaluation.evaluation</field> + <field name="view_type">form</field> + <field name="view_id" eval="False"/> + <field name="domain">[('state','!=','done'),('create_uid','=',uid)]</field> + <field name="search_view_id" ref="hr_evaluation.view_hr_evaluation_tree"/> + </record> + + <record id="board_hr_evaluation_form" model="ir.ui.view"> + <field name="name">board.hr.evaluation.form</field> + <field name="model">board.board</field> + <field name="inherit_id" ref="hr.board_hr_form"/> + <field name="type">form</field> + <field name="arch" type="xml"> + <xpath expr="/form/hpaned/child1" position="inside"> + <action colspan="4" height="220" name="%(act_hr_evaluation_tree)d" string="My Current Evaluations" width="510"/> + </xpath> + </field> + </record> + </data> +</openerp> diff --git a/addons/hr_evaluation/hr_evaluation.py b/addons/hr_evaluation/hr_evaluation.py index a1d89f67b28..3c13a8ab63c 100644 --- a/addons/hr_evaluation/hr_evaluation.py +++ b/addons/hr_evaluation/hr_evaluation.py @@ -49,7 +49,7 @@ class hr_evaluation_plan_phase(osv.osv): _columns = { 'name': fields.char("Phase", size=64, required=True), 'sequence': fields.integer("Sequence"), - 'company_id': fields.related('plan_id','company_id',type='many2one',relation='res.company',string='Company',store=True), + 'company_id': fields.related('plan_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True), 'plan_id': fields.many2one('hr_evaluation.plan','Evaluation Plan', required=True, ondelete='cascade'), 'action': fields.selection([ ('top-down','Top-Down Appraisal Requests'), @@ -68,7 +68,7 @@ class hr_evaluation_plan_phase(osv.osv): 'wait': fields.boolean('Wait Previous Phases', help="Check this box if you want to wait that all preceeding phases " + "are finished before launching this phase."), - 'mail_feature': fields.boolean('Send mail for this phase',help="Check this box if you want to send mail to employees"+ + 'mail_feature': fields.boolean('Send mail for this phase', help="Check this box if you want to send mail to employees"+ "coming under this phase"), 'mail_body': fields.text('Email'), 'email_subject':fields.text('char') @@ -105,11 +105,11 @@ class hr_employee(osv.osv): } def run_employee_evaluation(self, cr, uid, automatic=False, use_new_cursor=False, context=None): - for id in self.browse(cr, uid, self.search(cr, uid, [],context=context),context=context): + for id in self.browse(cr, uid, self.search(cr, uid, [], context=context), context=context): if id.evaluation_plan_id and id.evaluation_date: if (dt.ISO.ParseAny(id.evaluation_date) + dt.RelativeDateTime(months = int(id.evaluation_plan_id.month_next))).strftime('%Y-%m-%d') <= time.strftime("%Y-%m-%d"): - self.write(cr, uid, id.id, {'evaluation_date' : (dt.ISO.ParseAny(id.evaluation_date) + dt.RelativeDateTime(months =+ int(id.evaluation_plan_id.month_next))).strftime('%Y-%m-%d')},context=context) - self.pool.get("hr_evaluation.evaluation").create(cr, uid, {'employee_id' : id.id, 'plan_id': id.evaluation_plan_id},context) + self.write(cr, uid, id.id, {'evaluation_date' : (dt.ISO.ParseAny(id.evaluation_date) + dt.RelativeDateTime(months =+ int(id.evaluation_plan_id.month_next))).strftime('%Y-%m-%d')}, context=context) + self.pool.get("hr_evaluation.evaluation").create(cr, uid, {'employee_id' : id.id, 'plan_id': id.evaluation_plan_id}, context) return True def onchange_evaluation_plan_id(self, cr, uid, ids, evaluation_plan_id, evaluation_date, context={}): @@ -117,7 +117,7 @@ class hr_employee(osv.osv): evaluation_plan_obj=self.pool.get('hr_evaluation.plan') if evaluation_plan_id: flag = False - evaluation_plan = evaluation_plan_obj.browse(cr, uid, [evaluation_plan_id],context=context)[0] + evaluation_plan = evaluation_plan_obj.browse(cr, uid, [evaluation_plan_id], context=context)[0] if not evaluation_date: evaluation_date=(dt.ISO.ParseAny(dt.now().strftime('%Y-%m-%d'))+ dt.RelativeDateTime(months=+evaluation_plan.month_first)).strftime('%Y-%m-%d') flag = True @@ -126,13 +126,13 @@ class hr_employee(osv.osv): evaluation_date=(dt.ISO.ParseAny(evaluation_date)+ dt.RelativeDateTime(months=+evaluation_plan.month_next)).strftime('%Y-%m-%d') flag = True if ids and flag: - self.pool.get("hr_evaluation.evaluation").create(cr, uid, {'employee_id' : ids[0], 'plan_id': evaluation_plan_id},context=context) + self.pool.get("hr_evaluation.evaluation").create(cr, uid, {'employee_id' : ids[0], 'plan_id': evaluation_plan_id}, context=context) return {'value': {'evaluation_date':evaluation_date}} def create(self, cr, uid, vals, context={}): id = super(hr_employee, self).create(cr, uid, vals, context=context) if vals.get('evaluation_plan_id', False): - self.pool.get("hr_evaluation.evaluation").create(cr, uid, {'employee_id' : id, 'plan_id': vals['evaluation_plan_id']},context=context) + self.pool.get("hr_evaluation.evaluation").create(cr, uid, {'employee_id' : id, 'plan_id': vals['evaluation_plan_id']}, context=context) return id hr_employee() @@ -163,7 +163,7 @@ class hr_evaluation(osv.osv): ('progress','Final Validation'), ('done','Done'), ('cancel','Cancelled'), - ], 'State', required=True,readonly=True), + ], 'State', required=True, readonly=True), 'date_close': fields.date('Ending Date'), 'progress' : fields.float("Progress"), } @@ -172,19 +172,19 @@ class hr_evaluation(osv.osv): 'state' : lambda *a: 'draft', } - def onchange_employee_id(self,cr,uid,ids,employee_id,context={}): + 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],context=context): + for employee in employee_obj.browse(cr, uid, [employee_id], context=context): 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)],context=context) + employee_ids=employee_obj.search(cr, uid, [('parent_id','=',employee.id)], context=context) return {'value': {'plan_id':evaluation_plan_id}} - def button_plan_in_progress(self,cr, uid, ids, context={}): + def button_plan_in_progress(self, cr, uid, ids, context={}): apprai_id = [] - for evaluation in self.browse(cr,uid,ids, context): + for evaluation in self.browse(cr, uid, ids, context): wait = False for phase in evaluation.plan_id.phase_ids: childs = [] @@ -223,13 +223,13 @@ class hr_evaluation(osv.osv): sub = phase.email_subject dest = [child.work_email] if dest: - tools.email_send(src,dest,sub,body) + tools.email_send(src, dest, sub, body) - self.write(cr,uid,ids,{'state':'wait'},context=context) + self.write(cr, uid, ids, {'state':'wait'}, context=context) return True - def button_final_validation(self,cr, uid, ids, context={}): - self.write(cr,uid,ids,{'state':'progress'}) + 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,context=context): if len(id.survey_request_ids) != len(request_obj.search(cr, uid, [('evaluation_id', '=', id.id),('state', '=', 'done')],context=context)): @@ -240,8 +240,8 @@ class hr_evaluation(osv.osv): self.write(cr,uid,ids,{'state':'done', 'date_close': time.strftime('%Y-%m-%d')}, context=context) return True - def button_cancel(self,cr, uid, ids, context={}): - self.write(cr,uid,ids,{'state':'cancel'}, context=context) + def button_cancel(self, cr, uid, ids, context={}): + self.write(cr, uid, ids,{'state':'cancel'}, context=context) return True hr_evaluation() diff --git a/addons/hr_evaluation/hr_evaluation_view.xml b/addons/hr_evaluation/hr_evaluation_view.xml index cbb4c796c90..5784bb4d868 100644 --- a/addons/hr_evaluation/hr_evaluation_view.xml +++ b/addons/hr_evaluation/hr_evaluation_view.xml @@ -64,7 +64,7 @@ <menuitem name="Evaluations" parent="hr.menu_hr_root" id="menu_eval_hr" sequence="6"/> <menuitem - name="Periodic Evaluations" parent="hr.menu_hr_configuration" id="menu_eval_hr_config" sequence="3"/> + name="Periodic Evaluations" parent="hr.menu_hr_configuration" id="menu_eval_hr_config" sequence="4"/> <menuitem parent="menu_eval_hr_config" id="menu_open_view_hr_evaluation_plan_tree" diff --git a/addons/hr_evaluation/report/hr_evaluation_report.py b/addons/hr_evaluation/report/hr_evaluation_report.py index 504bdcd08f4..7c97ff5055e 100644 --- a/addons/hr_evaluation/report/hr_evaluation_report.py +++ b/addons/hr_evaluation/report/hr_evaluation_report.py @@ -30,7 +30,7 @@ class hr_evaluation_report(osv.osv): 'create_date': fields.date('Create Date', readonly=True), 'day': fields.char('Day', size=128, readonly=True), 'deadline': fields.date("Deadline", readonly=True), - 'request_id': fields.many2one('survey.request','Request_id', readonly=True), + 'request_id': fields.many2one('survey.request', 'Request_id', readonly=True), 'closed': fields.date("closed", readonly=True), 'year': fields.char('Year', size=4, readonly=True), 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), diff --git a/addons/hr_evaluation/report/hr_evaluation_report_view.xml b/addons/hr_evaluation/report/hr_evaluation_report_view.xml index 5406a7a3fbd..2a5cbe21ad9 100644 --- a/addons/hr_evaluation/report/hr_evaluation_report_view.xml +++ b/addons/hr_evaluation/report/hr_evaluation_report_view.xml @@ -82,7 +82,7 @@ <filter string="Plan" icon="terp-stock_align_left_24" context="{'group_by':'plan_id'}"/> <filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/> <separator orientation="vertical"/> - <filter string="Day" icon="terp-go-month" context="{'group_by':'day'}"/> + <filter string="Day" icon="terp-go-today" context="{'group_by':'day'}"/> <filter string="Month" icon="terp-go-month" context="{'group_by':'create_date'}"/> <filter string="Year" icon="terp-go-month" context="{'group_by':'year'}"/> </group> diff --git a/addons/hr_evaluation/test/test_hr_evaluation.yml b/addons/hr_evaluation/test/test_hr_evaluation.yml new file mode 100644 index 00000000000..6e9b11df3bc --- /dev/null +++ b/addons/hr_evaluation/test/test_hr_evaluation.yml @@ -0,0 +1,152 @@ +- | + In order to test hr_evaluation module for OpenERP, I will create plan then create evaluation under that plan. +- + | + Given that I have "R & D" Department for employee. +- + !record {model: hr.department, id: hr_department_rd0}: + manager_id: base.user_root + name: 'R & D ' +- + | + Given that I have Employee “Mark Johnson” which take Interview. + select "R & D" Department. +- + !record {model: hr.employee, id: hr_employee_employee0}: + address_home_id: base.res_partner_address_1 + company_id: base.main_company + gender: male + marital: hr.hr_employee_marital_status_single + name: Mark Johnson + user_id: base.user_root + department_id: 'hr_department_rd0' +- | + I create new employee “Phil Graves ” and select "Mark Johnson" as + Manager. +- + !record {model: hr.employee, id: hr_employee_employee1}: + address_home_id: base.res_partner_address_3000 + company_id: base.main_company + gender: male + name: Phil Graves + user_id: base.user_demo + parent_id: 'hr_employee_employee0' + +- | + I Create "Employee Evaluation" survey for Manager's Evaluation Plan. +- + !record {model: 'survey', id: survey_0}: + title: 'Employee Evaluation' + max_response_limit: 20 + response_user: 2 +- | + I Create "Employee Evaluation" page in "Employee Evaluation" survey. +- + !record {model: 'survey.page', id: survey_employee_page_0}: + title: 'Employee Evaluation' + survey_id: survey_0 +- | + I Create "What is your Name" question in "Employee Evaluation" survey page. +- + !record {model: 'survey.question', id: survey_p_question_0}: + question: 'What is your Name?' + type: 'single_textbox' + sequence: 1 + page_id: survey_employee_page_0 +- | + I Create "What is your gender" Question in "Employee Evaluation" survey page. +- + !record {model: 'survey.question', id: survey_p_question_1}: + question: 'What is your gender?' + type: multiple_choice_only_one_ans + sequence: 2 + is_require_answer: true + page_id: survey_employee_page_0 +- | + I Create "Male" answer in question "What is your gender?" +- + !record {model: 'survey.answer', id: survey_p_1_1}: + answer: 'Male' + sequence: 1 + question_id : survey_p_question_1 +- | + I Create "Female" answer in question "What is your gender?" +- + !record {model: 'survey.answer', id: survey_p_1_2}: + answer: 'Female' + sequence: 2 + question_id : survey_p_question_1 + +- | + Now Survey set in open state. +- + !python {model: survey}: | + self.survey_open(cr, uid, [ref("survey_0")], context) + +- | + I creating a Evaluation plan and select "Employee Evaluation" survey for "Send to Subordinates" and "Final interview with Manager" Phase. +- + !record {model: hr_evaluation.plan, id: hr_evaluation_plan_managersplan0}: + company_id: base.main_company + month_first: 3 + month_next: 6 + name: Manager's Plan + phase_ids: + - action: bottom-up + name: Send to Subordinates + survey_id: 'survey_0' + - action: top-down + name: Final Interview with manager + sequence: 2 + survey_id: 'survey_0' + +- | + Now I create Evaluation for "Phil Graves" Employee under "Manager Evaluation Plan". +- + !record {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0}: + date: '2010-06-28' + employee_id: 'hr_employee_employee1' + plan_id: 'hr_evaluation_plan_managersplan0' + progress: 0.0 + state: draft +- | + I check that Evaluation is in "Draft" state. +- + !assert {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0}: + - state == 'draft' +- | + I start Evaluation process by click on "Start Evaluation" button. +- + !python {model: hr_evaluation.evaluation}: | + self.button_plan_in_progress(cr, uid, [ref('hr_evaluation_evaluation_0')]) + +- | + After that Manager Evaluation plan is In Progress. + I close this servey request by giving answer of survey question. +- + !python {model: hr.evaluation.interview}: | + self.survey_req_done(cr, uid, [ref('hr_evaluation_evaluation_0')]) +- | + I click on "Final Validation" button to finalize Evaluation. +- + !python {model: hr_evaluation.evaluation}: | + self.button_final_validation(cr, uid, [ref("hr_evaluation.hr_evaluation_evaluation_0")], + {"active_ids": [ref("hr_evaluation.menu_open_view_hr_evaluation_tree")]}) + +- | + I check that state is "Final Validation". +- + !assert {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0}: + - state == 'progress' +- | + Give Rating "Meet expectations" by selecting overall Rating. +- + !record {model: hr_evaluation.evaluation, id: hr_evaluation.hr_evaluation_evaluation_0}: + rating: '2' + +- | + I close this Evaluation by click on "Done" button of this wizard. +- + !python {model: hr_evaluation.evaluation}: | + self.button_done(cr, uid, [ref("hr_evaluation.hr_evaluation_evaluation_0")], {"active_ids": [ref("hr_evaluation.menu_open_view_hr_evaluation_tree")]}) +
\ No newline at end of file |
