diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index cbc0abc4f4d..1040e9d9b5c 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -86,10 +86,10 @@ openerp.account = function (instance) {
var self = this;
var ids = this.get_selected_ids();
if (ids.length === 0) {
- instance.web.dialog($("
").text(_t("You must choose at least one record.")), {
+ new instance.web.Dialog(this, {
title: _t("Warning"),
- modal: true
- });
+ size: 'medium',
+ }, $("").text(_t("You must choose at least one record."))).open();
return false;
}
diff --git a/addons/board/static/src/js/dashboard.js b/addons/board/static/src/js/dashboard.js
index 65737ad234e..cf756e121da 100644
--- a/addons/board/static/src/js/dashboard.js
+++ b/addons/board/static/src/js/dashboard.js
@@ -88,15 +88,12 @@ instance.web.form.DashBoard = instance.web.form.FormWidget.extend({
var qdict = {
current_layout : this.$el.find('.oe_dashboard').attr('data-layout')
};
- var $dialog = instance.web.dialog($('
'), {
- modal: true,
+ var $dialog = instance.web.Dialog(this, {
title: _t("Edit Layout"),
- width: 'auto',
- height: 'auto'
- }).html(QWeb.render('DashBoard.layouts', qdict));
+ }, QWeb.render('DashBoard.layouts', qdict)).open();
$dialog.find('li').click(function() {
var layout = $(this).attr('data-layout');
- $dialog.dialog('destroy');
+ $dialog.modal('hide');
self.do_change_layout(layout);
});
},
diff --git a/addons/calendar/__openerp__.py b/addons/calendar/__openerp__.py
index 2f06a0b5cb9..f0417db1bf6 100644
--- a/addons/calendar/__openerp__.py
+++ b/addons/calendar/__openerp__.py
@@ -40,7 +40,6 @@ If you need to manage your meetings, you should install the CRM module.
'website': 'http://www.openerp.com',
'demo': ['calendar_demo.xml'],
'data': [
- 'security/calendar_security.xml',
'security/ir.model.access.csv',
'calendar_view.xml',
'contacts_view.xml',
diff --git a/addons/calendar/security/calendar_security.xml b/addons/calendar/security/calendar_security.xml
deleted file mode 100644
index 7c4363d21fc..00000000000
--- a/addons/calendar/security/calendar_security.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
- Survey / User
-
-
-
-
diff --git a/addons/calendar/security/ir.model.access.csv b/addons/calendar/security/ir.model.access.csv
index caa7f0c6970..4da2e1a1cc6 100644
--- a/addons/calendar/security/ir.model.access.csv
+++ b/addons/calendar/security/ir.model.access.csv
@@ -1,7 +1,6 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_calendar_attendee,calendar.attendee,model_calendar_attendee,,1,1,1,1
access_calendar_alarm,calendar.alarm,model_calendar_alarm,base.group_user,1,1,1,1
-access_calendar_attendee_survey_user,calendar.attendee,model_calendar_attendee,base.group_survey_user,1,0,0,0
access_calendar_event_manager,calendar.event.manager,model_calendar_event,base.group_sale_manager,1,1,1,1
access_calendar_event,calendar.event,model_calendar_event,base.group_sale_salesman,1,1,1,0
access_calendar_event_all,calendar.event_all,model_calendar_event,base.group_user,1,1,1,1
diff --git a/addons/gamification/models/goal.py b/addons/gamification/models/goal.py
index 80b2226e329..6ab4259cca2 100644
--- a/addons/gamification/models/goal.py
+++ b/addons/gamification/models/goal.py
@@ -269,14 +269,13 @@ class gamification_goal(osv.Model):
'cr': cr,
'context': dict(context), # copy context to prevent side-effects of eval
'uid': uid,
- 'result': False,
'date': date, 'datetime': datetime, 'timedelta': timedelta, 'time': time
}
code = definition.compute_code.strip()
safe_eval(code, cxt, mode="exec", nocopy=True)
# the result of the evaluated codeis put in the 'result' local variable, propagated to the context
- result = cxt.get('result', False)
- if result and type(result) in (float, int, long):
+ result = cxt.get('result')
+ if result is not None and type(result) in (float, int, long):
if result != goal.current:
goals_to_write[goal.id]['current'] = result
else:
diff --git a/addons/hr_evaluation/__openerp__.py b/addons/hr_evaluation/__openerp__.py
index 711571a2e89..2d62465ecb5 100644
--- a/addons/hr_evaluation/__openerp__.py
+++ b/addons/hr_evaluation/__openerp__.py
@@ -20,22 +20,24 @@
##############################################################################
{
- 'name' : 'Employee Appraisals',
+ 'name': 'Employee Appraisals',
'version': '0.1',
'author': 'OpenERP SA',
'category': 'Human Resources',
'sequence': 31,
'website': 'http://www.openerp.com',
'summary': 'Periodical Evaluations, Appraisals, Surveys',
- 'images': ['images/hr_evaluation_analysis.jpeg','images/hr_evaluation.jpeg','images/hr_interview_requests.jpeg'],
- 'depends': ['hr','calendar','survey'],
+ 'images': ['images/hr_evaluation_analysis.jpeg',
+ 'images/hr_evaluation.jpeg',
+ 'images/hr_interview_requests.jpeg'],
+ 'depends': ['hr', 'calendar', 'survey'],
'description': """
Periodical Employees evaluation and appraisals
==============================================
-By using this application you can maintain the motivational process by doing periodical evaluations of your employees' performance. The regular assessment of human resources can benefit your people as well your organization.
+By using this application you can maintain the motivational process by doing periodical evaluations of your employees' performance. The regular assessment of human resources can benefit your people as well your organization.
-An evaluation plan can be assigned to each employee. These plans define the frequency and the way you manage your periodic personal evaluations. You will be able to define steps and attach interview forms to each step.
+An evaluation plan can be assigned to each employee. These plans define the frequency and the way you manage your periodic personal evaluations. You will be able to define steps and attach interview forms to each step.
Manages several types of evaluations: bottom-up, top-down, self-evaluations and the final evaluation by the manager.
@@ -47,23 +49,22 @@ Key Features
* Every evaluation filled by employees can be viewed in a PDF form.
* Interview Requests are generated automatically by OpenERP according to employees evaluation plans. Each user receives automatic emails and requests to perform a periodical evaluation of their colleagues.
""",
- "demo": ["hr_evaluation_demo.xml"],
"data": [
'security/ir.model.access.csv',
'security/hr_evaluation_security.xml',
'hr_evaluation_view.xml',
'report/hr_evaluation_report_view.xml',
'board_hr_evaluation_view.xml',
+ 'survey_data_appraisal.xml',
'hr_evaluation_data.xml',
'hr_evaluation_installer.xml',
],
- 'test': [
- 'test/test_hr_evaluation.yml',
- 'test/hr_evalution_demo.yml',
- ],
+ "demo": ["hr_evaluation_demo.xml"],
+ # 'test': [
+ # 'test/test_hr_evaluation.yml',
+ # 'test/hr_evalution_demo.yml',
+ # ],
'auto_install': False,
'installable': True,
'application': True,
}
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/hr_evaluation/hr_evaluation.py b/addons/hr_evaluation/hr_evaluation.py
index 462154e9e4a..7d9f45f3585 100644
--- a/addons/hr_evaluation/hr_evaluation.py
+++ b/addons/hr_evaluation/hr_evaluation.py
@@ -19,15 +19,17 @@
#
##############################################################################
-from datetime import datetime
+from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
from dateutil import parser
import time
from openerp.osv import fields, osv
from openerp.tools.translate import _
+from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT as DF
-class hr_evaluation_plan(osv.osv):
+
+class hr_evaluation_plan(osv.Model):
_name = "hr_evaluation.plan"
_description = "Appraisal Plan"
_columns = {
@@ -42,11 +44,11 @@ class hr_evaluation_plan(osv.osv):
'active': True,
'month_first': 6,
'month_next': 12,
- 'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'account.account', context=c),
+ 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'account.account', context=c),
}
-class hr_evaluation_plan_phase(osv.osv):
+class hr_evaluation_plan_phase(osv.Model):
_name = "hr_evaluation.plan.phase"
_description = "Appraisal Plan Phase"
_order = "sequence"
@@ -54,13 +56,13 @@ class hr_evaluation_plan_phase(osv.osv):
'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, readonly=True),
- 'plan_id': fields.many2one('hr_evaluation.plan','Appraisal Plan', ondelete='cascade'),
+ 'plan_id': fields.many2one('hr_evaluation.plan', 'Appraisal Plan', ondelete='cascade'),
'action': fields.selection([
- ('top-down','Top-Down Appraisal Requests'),
- ('bottom-up','Bottom-Up Appraisal Requests'),
- ('self','Self Appraisal Requests'),
- ('final','Final Interview')], 'Action', required=True),
- 'survey_id': fields.many2one('survey','Appraisal Form',required=True),
+ ('top-down', 'Top-Down Appraisal Requests'),
+ ('bottom-up', 'Bottom-Up Appraisal Requests'),
+ ('self', 'Self Appraisal Requests'),
+ ('final', 'Final Interview')], 'Action', required=True),
+ 'survey_id': fields.many2one('survey.survey', 'Appraisal Form', required=True),
'send_answer_manager': fields.boolean('All Answers',
help="Send all answers to the manager"),
'send_answer_employee': fields.boolean('All Answers',
@@ -72,15 +74,14 @@ class hr_evaluation_plan_phase(osv.osv):
'wait': fields.boolean('Wait Previous Phases',
help="Check this box if you want to wait that all preceding 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"+
- " coming under this phase"),
+ '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')
+ 'email_subject': fields.text('Subject')
}
_defaults = {
'sequence': 1,
'email_subject': _('''Regarding '''),
- 'mail_body': lambda *a:_('''
+ 'mail_body': lambda *a: _('''
Date: %(date)s
Dear %(employee_name)s,
@@ -98,26 +99,24 @@ Thanks,
}
-class hr_employee(osv.osv):
+class hr_employee(osv.Model):
_name = "hr.employee"
- _inherit="hr.employee"
-
+ _inherit = "hr.employee"
_columns = {
'evaluation_plan_id': fields.many2one('hr_evaluation.plan', 'Appraisal Plan'),
'evaluation_date': fields.date('Next Appraisal Date', help="The date of the next appraisal is computed by the appraisal plan's dates (first appraisal + periodicity)."),
}
- def run_employee_evaluation(self, cr, uid, automatic=False, use_new_cursor=False, context=None):
+
+ def run_employee_evaluation(self, cr, uid, automatic=False, use_new_cursor=False, context=None): # cronjob
now = parser.parse(datetime.now().strftime('%Y-%m-%d'))
obj_evaluation = self.pool.get('hr_evaluation.evaluation')
- emp_ids =self.search(cr, uid, [ ('evaluation_plan_id','<>',False), ('evaluation_date','=', False)], context=context)
+ emp_ids = self.search(cr, uid, [('evaluation_plan_id', '<>', False), ('evaluation_date', '=', False)], context=context)
for emp in self.browse(cr, uid, emp_ids, context=context):
- first_date = (now+ relativedelta(months=emp.evaluation_plan_id.month_first)).strftime('%Y-%m-%d')
+ first_date = (now + relativedelta(months=emp.evaluation_plan_id.month_first)).strftime('%Y-%m-%d')
self.write(cr, uid, [emp.id], {'evaluation_date': first_date}, context=context)
- emp_ids =self.search(cr, uid, [
- ('evaluation_plan_id','<>',False), ('evaluation_date','<=', time.strftime("%Y-%m-%d")),
- ], context=context)
+ emp_ids = self.search(cr, uid, [('evaluation_plan_id', '<>', False), ('evaluation_date', '<=', time.strftime("%Y-%m-%d"))], context=context)
for emp in self.browse(cr, uid, emp_ids, context=context):
next_date = (now + relativedelta(months=emp.evaluation_plan_id.month_next)).strftime('%Y-%m-%d')
self.write(cr, uid, [emp.id], {'evaluation_date': next_date}, context=context)
@@ -126,39 +125,35 @@ class hr_employee(osv.osv):
return True
-
-class hr_evaluation(osv.osv):
+class hr_evaluation(osv.Model):
_name = "hr_evaluation.evaluation"
_inherit = "mail.thread"
_description = "Employee Appraisal"
- _rec_name = 'employee_id'
_columns = {
'date': fields.date("Appraisal Deadline", required=True, select=True),
'employee_id': fields.many2one('hr.employee', "Employee", required=True),
'note_summary': fields.text('Appraisal Summary'),
- 'note_action': fields.text('Action Plan',
- help="If the evaluation does not meet the expectations, you can propose"+
- "an action plan"),
+ 'note_action': fields.text('Action Plan', help="If the evaluation does not meet the expectations, you can propose an action plan"),
'rating': fields.selection([
- ('0','Significantly bellow expectations'),
- ('1','Did not meet expectations'),
- ('2','Meet expectations'),
- ('3','Exceeds expectations'),
- ('4','Significantly exceeds expectations'),
+ ('0', 'Significantly below expectations'),
+ ('1', 'Do not meet expectations'),
+ ('2', 'Meet expectations'),
+ ('3', 'Exceeds expectations'),
+ ('4', 'Significantly exceeds expectations'),
], "Appreciation", help="This is the appreciation on which the evaluation is summarized."),
- 'survey_request_ids': fields.one2many('hr.evaluation.interview','evaluation_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','New'),
- ('cancel','Cancelled'),
- ('wait','Plan In Progress'),
- ('progress','Waiting Appreciation'),
- ('done','Done'),
+ ('draft', 'New'),
+ ('cancel', 'Cancelled'),
+ ('wait', 'Plan In Progress'),
+ ('progress', 'Waiting Appreciation'),
+ ('done', 'Done'),
], 'Status', required=True, readonly=True),
'date_close': fields.date('Ending Date', select=True),
}
_defaults = {
- 'date': lambda *a: (parser.parse(datetime.now().strftime('%Y-%m-%d')) + relativedelta(months =+ 1)).strftime('%Y-%m-%d'),
+ 'date': lambda *a: (parser.parse(datetime.now().strftime('%Y-%m-%d')) + relativedelta(months=+1)).strftime('%Y-%m-%d'),
'state': lambda *a: 'draft',
}
@@ -169,7 +164,8 @@ class hr_evaluation(osv.osv):
res = []
for record in reads:
name = record.plan_id.name
- res.append((record['id'], name))
+ employee = record.employee_id.name_related
+ res.append((record['id'], name + ' / ' + employee))
return res
def onchange_employee_id(self, cr, uid, ids, employee_id, context=None):
@@ -183,7 +179,6 @@ class hr_evaluation(osv.osv):
return {'value': vals}
def button_plan_in_progress(self, cr, uid, ids, context=None):
- mail_message = self.pool.get('mail.message')
hr_eval_inter_obj = self.pool.get('hr.evaluation.interview')
if context is None:
context = {}
@@ -202,10 +197,9 @@ class hr_evaluation(osv.osv):
int_id = hr_eval_inter_obj.create(cr, uid, {
'evaluation_id': evaluation.id,
- 'survey_id': phase.survey_id.id,
- 'date_deadline': (parser.parse(datetime.now().strftime('%Y-%m-%d')) + relativedelta(months =+ 1)).strftime('%Y-%m-%d'),
+ 'phase_id': phase.id,
+ 'deadline': (parser.parse(datetime.now().strftime('%Y-%m-%d')) + relativedelta(months=+1)).strftime('%Y-%m-%d'),
'user_id': child.user_id.id,
- 'user_to_review_id': evaluation.employee_id.id
}, context=context)
if phase.wait:
wait = True
@@ -214,7 +208,7 @@ class hr_evaluation(osv.osv):
if (not wait) and phase.mail_feature:
body = phase.mail_body % {'employee_name': child.name, 'user_signature': child.user_id.signature,
- 'eval_name': phase.survey_id.title, 'date': time.strftime('%Y-%m-%d'), 'time': time }
+ 'eval_name': phase.survey_id.title, 'date': time.strftime('%Y-%m-%d'), 'time': time}
sub = phase.email_subject
if child.work_email:
vals = {'state': 'outgoing',
@@ -224,32 +218,32 @@ class hr_evaluation(osv.osv):
'email_from': evaluation.employee_id.work_email}
self.pool.get('mail.mail').create(cr, uid, vals, context=context)
- 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=None):
request_obj = self.pool.get('hr.evaluation.interview')
- self.write(cr, uid, ids, {'state':'progress'}, context=context)
+ self.write(cr, uid, ids, {'state': 'progress'}, context=context)
for evaluation in self.browse(cr, uid, ids, context=context):
if evaluation.employee_id and evaluation.employee_id.parent_id and evaluation.employee_id.parent_id.user_id:
self.message_subscribe_users(cr, uid, [evaluation.id], user_ids=[evaluation.employee_id.parent_id.user_id.id], context=context)
- if len(evaluation.survey_request_ids) != len(request_obj.search(cr, uid, [('evaluation_id', '=', evaluation.id),('state', 'in', ['done','cancel'])], context=context)):
- raise osv.except_osv(_('Warning!'),_("You cannot change state, because some appraisal(s) are in waiting answer or draft state."))
+ if len(evaluation.survey_request_ids) != len(request_obj.search(cr, uid, [('evaluation_id', '=', evaluation.id), ('state', 'in', ['done', 'cancel'])], context=context)):
+ raise osv.except_osv(_('Warning!'), _("You cannot change state, because some appraisal forms have not been completed."))
return True
def button_done(self, cr, uid, ids, context=None):
- self.write(cr, uid, ids,{'state':'done', 'date_close': time.strftime('%Y-%m-%d')}, context=context)
+ 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=None):
- interview_obj=self.pool.get('hr.evaluation.interview')
+ interview_obj = self.pool.get('hr.evaluation.interview')
evaluation = self.browse(cr, uid, ids[0], context)
interview_obj.survey_req_cancel(cr, uid, [r.id for r in evaluation.survey_request_ids])
- self.write(cr, uid, ids,{'state':'cancel'}, context=context)
+ self.write(cr, uid, ids, {'state': 'cancel'}, context=context)
return True
def button_draft(self, cr, uid, ids, context=None):
- self.write(cr, uid, ids,{'state': 'draft'}, context=context)
+ self.write(cr, uid, ids, {'state': 'draft'}, context=context)
return True
def copy(self, cr, uid, id, default=None, context=None):
@@ -260,65 +254,90 @@ class hr_evaluation(osv.osv):
default = default.copy()
default['survey_request_ids'] = []
return super(hr_evaluation, self).copy(cr, uid, id, default, context=context)
-
+
def write(self, cr, uid, ids, vals, context=None):
if vals.get('employee_id'):
employee_id = self.pool.get('hr.employee').browse(cr, uid, vals.get('employee_id'), context=context)
if employee_id.parent_id and employee_id.parent_id.user_id:
vals['message_follower_ids'] = [(4, employee_id.parent_id.user_id.partner_id.id)]
if 'date' in vals:
- new_vals = {'date_deadline': vals.get('date')}
+ new_vals = {'deadline': vals.get('date')}
obj_hr_eval_iterview = self.pool.get('hr.evaluation.interview')
- for evalutation in self.browse(cr, uid, ids, context=context):
- for survey_req in evalutation.survey_request_ids:
+ for evaluation in self.browse(cr, uid, ids, context=context):
+ for survey_req in evaluation.survey_request_ids:
obj_hr_eval_iterview.write(cr, uid, [survey_req.id], new_vals, context=context)
return super(hr_evaluation, self).write(cr, uid, ids, vals, context=context)
-class survey_request(osv.osv):
- _inherit = "survey.request"
- _columns = {
- 'is_evaluation': fields.boolean('Is Appraisal?'),
- }
-
-
-class hr_evaluation_interview(osv.osv):
+class hr_evaluation_interview(osv.Model):
_name = 'hr.evaluation.interview'
- _inherits = {'survey.request': 'request_id'}
- _inherit = 'mail.thread'
- _rec_name = 'request_id'
+ _inherit = 'mail.thread'
+ _rec_name = 'user_to_review_id'
_description = 'Appraisal Interview'
_columns = {
- 'request_id': fields.many2one('survey.request','Request_id', ondelete='cascade', required=True),
- 'user_to_review_id': fields.many2one('hr.employee', 'Employee to Interview'),
- 'evaluation_id': fields.many2one('hr_evaluation.evaluation', 'Appraisal Form'),
+ 'request_id': fields.many2one('survey.user_input', 'Survey Request', ondelete='cascade', readonly=True),
+ 'evaluation_id': fields.many2one('hr_evaluation.evaluation', 'Appraisal Plan', required=True),
+ 'phase_id': fields.many2one('hr_evaluation.plan.phase', 'Appraisal Phase', required=True),
+ 'user_to_review_id': fields.related('evaluation_id', 'employee_id', type="many2one", relation="hr.employee", string="Employee to evaluate"),
+ 'user_id': fields.many2one('res.users', 'Interviewer'),
+ 'state': fields.selection([('draft', "Draft"),
+ ('waiting_answer', "In progress"),
+ ('done', "Done"),
+ ('cancel', "Cancelled")],
+ string="State", required=True),
+ 'survey_id': fields.related('phase_id', 'survey_id', string="Appraisal Form", type="many2one", relation="survey.survey"),
+ 'deadline': fields.related('request_id', 'deadline', type="datetime", string="Deadline"),
}
_defaults = {
- 'is_evaluation': True,
+ 'state': 'draft'
}
+ def create(self, cr, uid, vals, context=None):
+ phase_obj = self.pool.get('hr_evaluation.plan.phase')
+ survey_id = phase_obj.read(cr, uid, vals.get('phase_id'), fields=['survey_id'], context=context)['survey_id'][0]
+
+ if vals.get('user_id'):
+ user_obj = self.pool.get('res.users')
+ partner_id = user_obj.read(cr, uid, vals.get('user_id'), fields=['partner_id'], context=context)['partner_id'][0]
+ else:
+ partner_id = None
+
+ user_input_obj = self.pool.get('survey.user_input')
+
+ if not vals.get('deadline'):
+ vals['deadline'] = (datetime.now() + timedelta(days=28)).strftime(DF)
+
+ ret = user_input_obj.create(cr, uid, {'survey_id': survey_id,
+ 'deadline': vals.get('deadline'),
+ 'type': 'link',
+ 'partner_id': partner_id}, context=context)
+ vals['request_id'] = ret
+ return super(hr_evaluation_interview, self).create(cr, uid, vals, context=context)
+
def name_get(self, cr, uid, ids, context=None):
if not ids:
return []
reads = self.browse(cr, uid, ids, context=context)
res = []
for record in reads:
- name = record.request_id.survey_id.title
+ name = record.survey_id.title
res.append((record['id'], name))
return res
def survey_req_waiting_answer(self, cr, uid, ids, context=None):
- self.write(cr, uid, ids, { 'state': 'waiting_answer'}, context=context)
+ request_obj = self.pool.get('survey.user_input')
+ for interview in self.browse(cr, uid, ids, context=context):
+ request_obj.action_survey_resent(cr, uid, [interview.id], context=context)
+ self.write(cr, uid, interview.id, {'state': 'waiting_answer'}, context=context)
return True
def survey_req_done(self, cr, uid, ids, context=None):
- hr_eval_obj = self.pool.get('hr_evaluation.evaluation')
for id in self.browse(cr, uid, ids, context=context):
flag = False
wating_id = 0
if not id.evaluation_id.id:
- raise osv.except_osv(_('Warning!'),_("You cannot start evaluation without Appraisal."))
- records = hr_eval_obj.browse(cr, uid, [id.evaluation_id.id], context=context)[0].survey_request_ids
+ raise osv.except_osv(_('Warning!'), _("You cannot start evaluation without Appraisal."))
+ records = id.evaluation_id.survey_request_ids
for child in records:
if child.state == "draft":
wating_id = child.id
@@ -327,35 +346,29 @@ class hr_evaluation_interview(osv.osv):
flag = True
if not flag and wating_id:
self.survey_req_waiting_answer(cr, uid, [wating_id], context=context)
- self.write(cr, uid, ids, { 'state': 'done'}, context=context)
- return True
-
- def survey_req_draft(self, cr, uid, ids, context=None):
- self.write(cr, uid, ids, { 'state': 'draft'}, context=context)
+ self.write(cr, uid, ids, {'state': 'done'}, context=context)
return True
def survey_req_cancel(self, cr, uid, ids, context=None):
- self.write(cr, uid, ids, { 'state': 'cancel'}, context=context)
+ self.write(cr, uid, ids, {'state': 'cancel'}, context=context)
return True
def action_print_survey(self, cr, uid, ids, context=None):
- """
- If response is available then print this response otherwise print survey form(print template of the survey).
+ """ If response is available then print this response otherwise print survey form (print template of the survey) """
+ context = context if context else {}
+ interview = self.browse(cr, uid, ids, context=context)[0]
+ survey_obj = self.pool.get('survey.survey')
+ response_obj = self.pool.get('survey.user_input')
+ response = response_obj.browse(cr, uid, interview.request_id.id, context=context)
+ context.update({'survey_token': response.token})
+ return survey_obj.action_print_survey(cr, uid, [interview.survey_id.id], context=context)
- @param self: The object pointer
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of Survey IDs
- @param context: A standard dictionary for contextual values
- @return: Dictionary value for print survey form.
- """
- if context is None:
- context = {}
- record = self.browse(cr, uid, ids, context=context)
- record = record and record[0]
- context.update({'survey_id': record.survey_id.id, 'response_id': [record.response.id], 'response_no':0,})
- value = self.pool.get("survey").action_print_survey(cr, uid, ids, context=context)
- return value
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:1
+ def action_start_survey(self, cr, uid, ids, context=None):
+ context = context if context else {}
+ interview = self.browse(cr, uid, ids, context=context)[0]
+ survey_obj = self.pool.get('survey.survey')
+ response_obj = self.pool.get('survey.user_input')
+ # grab the token of the response and start surveying
+ response = response_obj.browse(cr, uid, interview.request_id.id, context=context)
+ context.update({'survey_token': response.token})
+ return survey_obj.action_start_survey(cr, uid, [interview.survey_id.id], context=context)
diff --git a/addons/hr_evaluation/hr_evaluation_data.xml b/addons/hr_evaluation/hr_evaluation_data.xml
index 2afb5200091..38171b0f733 100644
--- a/addons/hr_evaluation/hr_evaluation_data.xml
+++ b/addons/hr_evaluation/hr_evaluation_data.xml
@@ -1,4 +1,4 @@
-
+
@@ -16,1146 +16,7 @@
Manage employee reviews: you can define an appraisal campaign with several steps, with specific evaluation surveys according to hierarchy levels. Evaluations filled by employees may be exported as pdf files.]]>
-
- Self Appraisal
- 20
-
-
-
- 5
- open
-
-
- Employee Appraisal Form
-
-
-
-
- Work Plan
-
-
-
-
- Employee Performance In Key Areas
-
-
- The appraiser should rate the employee’s major work accomplishments and performance according to the metric provided below :
- 1 - Significantly exceeds standards and expectations required of the position
- 2 - Exceeds standards and expectations
- 3 - Meet standards and expectations
- 4 - Did not meet standards and expectations
- 5 - Significantly below standards and expectations
-
-
- Professional Development And Performance Plan (optional)
-
-
- Identify professional, performance, or project objectives you recommend for employee’s continued career development over the coming year.
-
-
- Employee Comments
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- Employee Information
-
- multiple_textboxes_diff_type
- The comment you entered is in an invalid format.
-
-
-
- Other
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- Overall Purpose Of Employee Appraisal
-
- descriptive_text
- The comment you entered is in an invalid format.
- * To initiate a clear and open communication of performance expectations
-* To assist employees in their professional growth, through the identification of strengths and opportunities for development
-
-
-
- Other
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- At the outset of the appraisal time period
-
- descriptive_text
- The comment you entered is in an invalid format.
- * It is the joint responsibility of the employee and the supervisor (appraiser) to establish a feasible work plan for the coming year, including major employee responsibilities and corresponding benchmarks against which results will be evaluated.
-* Critical or key elements of performance and professional development needs (if any), should also be noted at this time
-
-
-
- Other
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- At the conclusion of the appraisal time period
-
- descriptive_text
- The comment you entered is in an invalid format.
- * The employee will be responsible for completing a draft of the Appraisal Form as a tool for self-appraisal and a starting point for the supervisor’s evaluation. The employee can add examples of achievements for each criterion.
-Once the form had been filled, the employee send it to his supervisor.
-
-* It is the primary responsibility of the supervisor to gather the necessary input from the appropriate sources of feedback (internal and/or external customers, peers). In case of collaboration with OpenERP SA Belgium, the supervisor must receive completed evaluation form from the employee's Belgian project manager.
-
-* The supervisor synthesizes and integrates all input into the completed appraisal. He motivates his evaluation in the ad hoc fields.
-
-* The employee may choose to offer comments or explanation regarding the completed review.
-
-* The supervisor send the form to the HR department in India and in Belgium.
-
-
-
- Other
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- Work Plan
-
- table
- The comment you entered is in an invalid format.
-
-
-
- Other
-
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- Additional comments :
-
- comment
- The comment you entered is in an invalid format.
-
-
-
- Other
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- Subject
-
- matrix_of_choices_only_one_ans
- Recommendations / Appraisals
- The comment you entered is in an invalid format.
-
-
-
- Other
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- Supervisors only :
-
- matrix_of_choices_only_one_ans
- Recommendations / Appraisals
- The comment you entered is in an invalid format.
-
-
-
- Other
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- Overall Performance Summary Rating
-
- descriptive_text
- The comment you entered is in an invalid format.
- including the project evaluation form (if any)
-
-
-
- Other
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- Professional Development Objectives
-
- comment
- The comment you entered is in an invalid format.
-
-
-
- Other
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- Personal Performance Objectives
-
- comment
- The comment you entered is in an invalid format.
-
-
-
- Other
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- Project Objectives
-
- comment
- The comment you entered is in an invalid format.
-
-
-
- Other
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- Use the following space to make any comments regarding the above performance evaluation.
-
- comment
- The comment you entered is in an invalid format.
-
-
-
- Other
-
-
-
-
- Name
-
- char
-
-
-
- Position Title
-
- char
-
-
-
- Appraisal for Period
-
- char
-
-
-
- Date of Review
-
- datetime
-
-
-
- Appraiser
-
- char
-
-
-
- 1
- 1
- 1
-
-
-
- 1
- 1
- 2
-
-
-
- 1
- 1
- 3
-
-
-
- 1
- 1
- 4
-
-
-
- 1
- 1
- 5
-
-
-
- 1
- Ability to cope with multidisciplinary of team
-
-
-
-
- 1
- Enthusiasm & implication toward projects/assignments
-
-
-
-
- 1
- Compliance to internal rules and processes (timesheets completion, etc.)
-
-
-
-
- 1
- Team spirit : ability to work efficiently with peers, manage the conflicts with diplomacy
-
-
-
-
- 1
- Initiative and self autonomy
-
-
-
-
- 1
- Ability to follow and complete work as instructed
-
-
-
-
- 1
- Decision making
-
-
-
-
- 1
- Customer commitment
-
-
-
-
- 1
- Communication skills ( written & verbally): clearness, concision, exactitude
-
-
-
-
- 1
- Technical skills regarding to the job requirements
-
-
-
-
- 1
- Analytical and synthetic mind
-
-
-
-
- 1
- Promptness and attendance record
-
-
-
-
- 1
- Adaptability : Ability to adapt oneself to organizational changes while keeping efficiency
-
-
-
-
- 1
- Creativity and forward looking aptitude
-
-
-
-
- 1
- Time management : projects/tasks are completed on time
-
-
-
-
- 1
- 1
- 1
-
-
-
- 1
- 1
- 2
-
-
-
- 1
- 1
- 3
-
-
-
- 1
- 1
- 4
-
-
-
- 1
- 1
- 5
-
-
-
- 1
- Results of the bottom-up survey and mitigation actions to face technical, organizational, structural and/or relational issues
-
-
-
-
- 1
- Delegation : Ability to efficiently assign tasks to other people
-
-
-
-
- 1
- Leadership: create a challenging and motivating work environment aligned with the company's strategy
-
-
-
-
- 1
- Leadership: sustain subordinates in their professional growth
-
-
-
-
- 1
- Ability to manage planning resources, risks, budgets and deadlines
-
-
-
-
- 1
- 1
- Objectives
-
-
-
- 1
- 1
- Results
-
-
-
- 1
- 1
- Comments
-
-
-
- 1
- At the conclusion of the appraisal time period:
-
-
-
-
- 1
- At the outset of the appraisal time period:
-
-
-
-
-
- Employee Opinion
- 20
-
-
-
- 5
-
-
- Process
-
-
-
-
- Survey
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- Employee Details
-
- multiple_textboxes_diff_type
- The comment you entered is in an invalid format.
-
-
-
- Other
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- Engagement
-
- matrix_of_choices_only_one_ans
- The comment you entered is in an invalid format.
-
-
-
- Other
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- Leadership
-
- matrix_of_choices_only_one_ans
-
-
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- Effectiveness
-
- matrix_of_choices_only_one_ans
- The comment you entered is in an invalid format.
-
-
-
- Other
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- Continuous Improvement
-
- matrix_of_choices_only_one_ans
- The comment you entered is in an invalid format.
-
-
-
- Other
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- Openness
-
- matrix_of_choices_only_one_ans
- The comment you entered is in an invalid format.
-
-
-
- Other
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- Miscellaneous
-
- matrix_of_choices_only_one_ans
- The comment you entered is in an invalid format.
-
-
-
- Other
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- Additional comments :
-
- comment
- The comment you entered is in an invalid format.
-
-
-
- Other
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- At the supervisor's appraisal date
-
- descriptive_text
- The comment you entered is in an invalid format.
- * His direct reports will be invited through OpenERP to express a feedback on their supervisor's leadership and to give their opinion about their own engagement and effectiveness, the continuous improvement and openness in action in the company, ...
-
-* The employees will send back their anonymous answers to OpenERP. The data will be handled by the HR manager and a brief summary of the data will be sent to the concerned supervisor, to his team and to the supervisor's supervisor.
-* The appraiser should rate the employee’s major work accomplishments and performance according to the metric provided below :
-
- 1 - Significantly exceeds standards and expectations required of the position
- 2 - Exceeds standards and expectations
- 3 - Meet standards and expectations
- 4 - Did not meet standards and expectations
- 5 - Significantly below standards and expectations
-
-
-
- Other
-
-
-
-
- 1
- 1
- 1
-
-
-
- 1
- 1
- 2
-
-
-
- 1
- 1
- 3
-
-
-
- 1
- 1
- 4
-
-
-
- 1
- 1
- 5
-
-
-
- 1
- 1
- 1
-
-
-
- 1
- 1
- 2
-
-
-
- 1
- 1
- 3
-
-
-
- 1
- 1
- 4
-
-
-
- 1
- 1
- 5
-
-
-
- 1
- 1
- 1
-
-
-
- 1
- 1
- 2
-
-
-
- 1
- 1
- 3
-
-
-
- 1
- 1
- 4
-
-
-
- 1
- 1
- 5
-
-
-
- 1
- 1
- 1
-
-
-
- 1
- 1
- 2
-
-
-
- 1
- 1
- 3
-
-
-
- 1
- 1
- 4
-
-
-
- 1
- 1
- 5
-
-
-
- 1
- 1
- 1
-
-
-
- 1
- 1
- 2
-
-
-
- 1
- 1
- 3
-
-
-
- 1
- 1
- 4
-
-
-
- 1
- 1
- 5
-
-
-
- 1
- 1
- 1
-
-
-
- 1
- 1
- 2
-
-
-
- 1
- 1
- 3
-
-
-
- 1
- 1
- 4
-
-
-
- 1
- 1
- 5
-
-
-
- 1
- Demonstrates genuine concern for me as a person.
-
-
-
-
- 1
- I'm efficient at work and my achievements are successful.
-
-
-
-
- 1
- I am proud to tell others I work here.
-
-
-
-
- 0
- Name of your direct supervisor
-
- char
-
-
-
- 1
- Actions by Executive management show genuine interest in the well-being of employees.
-
-
-
-
- 1
- I know the company's values and live them.
-
-
-
-
- 1
- My work contributes towards the continuous improvement of the company, our services or products.
-
-
-
-
- 1
- I have enough work.
-
-
-
-
- 0
- Date
-
- datetime
-
-
-
- 1
- I consistently acquire new knowledge, skills or understanding through contact with my supervisor. He helps me growing my compete
-
-
-
-
- 1
- My job provides me with a sense of personal accomplishment.
-
-
-
-
- 1
- What I did several months ago is still of use to the company, the services or the products today.
-
-
-
-
- 1
- My best achievements have been communicated to the community, internally or to customers.
-
-
-
-
- 1
- I have the same opportunity to succeed as others with similar experiences, performance and educational background.
-
-
-
-
- 1
- Compared to similar jobs in other companies where I could work, my total compensation is:
-(Scale: Well below others, Below othe
-
-
-
-
- 1
- Overall, I believe the quality of products and/or services my workgroup delivers is improving.
-
-
-
-
- 1
- I would prefer to remain with this company even if a comparable job were available in another company.
-
-
-
-
- 1
- Listens and takes into account all ideas and do his best to put in place the best of these.
-
-
-
-
- 1
- I mostly work on value-added tasks for the company, the products or the services. (Value-added task : significant improvement pe
-
-
-
-
- 1
- Our workgroup identifies and reduces waste of time in our activities and processes.
-
-
-
-
- 1
- Taking everything into account, how satisfied are you with your current job?
-
-
-
-
- 1
- I understand the company strategy and how my workgroup supports it.
-
-
-
-
- 1
- I am willing to put in a great deal of effort beyond what is expected to help my workgroup succeed.
-
-
-
-
- 1
- I believe the information that I get from the person I report to.
-
-
-
-
-
-
@@ -1163,9 +24,8 @@ Once the form had been filled, the employee send it to his supervisor.
-
-
+
Send to Employee
@@ -1175,19 +35,17 @@ Once the form had been filled, the employee send it to his supervisor.
self
-
+
-
-
+
-
-
+
Run Employee Appraisal
diff --git a/addons/hr_evaluation/hr_evaluation_view.xml b/addons/hr_evaluation/hr_evaluation_view.xml
index 28bc4a6c96e..8f3998eeb42 100644
--- a/addons/hr_evaluation/hr_evaluation_view.xml
+++ b/addons/hr_evaluation/hr_evaluation_view.xml
@@ -21,24 +21,26 @@
hr_evaluation.plan
-
+
hr_evaluation.plan.form
@@ -58,9 +60,9 @@
formtree,form
-
+
-
+
hr.evaluation.interviewform
@@ -127,7 +129,7 @@
-
+
@@ -165,11 +167,9 @@
-
- Click to create a new interview request related to a personal evaluation.
+ Click to create a new interview request related to a personal evaluation.
Interview requests are usually generated automatically by
OpenERP according to an employee's appraisal plan. Each user
@@ -425,7 +397,7 @@
target="new" multi="True"
key2="client_action_multi"
context="{'default_composition_mode': 'mass_mail',
- 'default_body_text': 'Hello,\n\nKindly post your response for the survey interview.\n\nThanks',
+ 'default_body': 'Hello,\n\nKindly post your response for the survey interview.\n\nThanks',
'default_subject': 'Reminder to fill up Survey'}"/>
diff --git a/addons/hr_evaluation/report/hr_evaluation_report.py b/addons/hr_evaluation/report/hr_evaluation_report.py
index 36353b65dfb..ce6f381fb60 100644
--- a/addons/hr_evaluation/report/hr_evaluation_report.py
+++ b/addons/hr_evaluation/report/hr_evaluation_report.py
@@ -22,41 +22,43 @@
from openerp import tools
from openerp.osv import fields, osv
-class hr_evaluation_report(osv.osv):
+
+class hr_evaluation_report(osv.Model):
_name = "hr.evaluation.report"
_description = "Evaluations Statistics"
_auto = False
_columns = {
'create_date': fields.date('Create Date', readonly=True),
- 'delay_date':fields.float('Delay to Start', digits=(16,2),readonly=True),
- 'overpass_delay':fields.float('Overpassed Deadline', digits=(16,2), readonly=True),
+ 'delay_date': fields.float('Delay to Start', digits=(16, 2), readonly=True),
+ 'overpass_delay': fields.float('Overpassed Deadline', digits=(16, 2), 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.user_input', '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'),
- ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
- ('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
+ 'month': fields.selection([('01', 'January'), ('02', 'February'), ('03', 'March'), ('04', 'April'),
+ ('05', 'May'), ('06', 'June'), ('07', 'July'), ('08', 'August'), ('09', 'September'),
+ ('10', 'October'), ('11', 'November'), ('12', 'December')], 'Month', readonly=True),
'plan_id': fields.many2one('hr_evaluation.plan', 'Plan', readonly=True),
'employee_id': fields.many2one('hr.employee', "Employee", readonly=True),
'rating': fields.selection([
- ('0','Significantly bellow expectations'),
- ('1','Did not meet expectations'),
- ('2','Meet expectations'),
- ('3','Exceeds expectations'),
- ('4','Significantly exceeds expectations'),
+ ('0', 'Significantly bellow expectations'),
+ ('1', 'Did not meet expectations'),
+ ('2', 'Meet expectations'),
+ ('3', 'Exceeds expectations'),
+ ('4', 'Significantly exceeds expectations'),
], "Overall Rating", readonly=True),
- 'nbr':fields.integer('# of Requests', readonly=True),
+ 'nbr': fields.integer('# of Requests', readonly=True),
'state': fields.selection([
- ('draft','Draft'),
- ('wait','Plan In Progress'),
- ('progress','Final Validation'),
- ('done','Done'),
- ('cancel','Cancelled'),
- ], 'Status',readonly=True),
+ ('draft', 'Draft'),
+ ('wait', 'Plan In Progress'),
+ ('progress', 'Final Validation'),
+ ('done', 'Done'),
+ ('cancel', 'Cancelled'),
+ ], 'Status', readonly=True),
}
_order = 'create_date desc'
+
def init(self, cr):
tools.drop_view_if_exists(cr, 'hr_evaluation_report')
cr.execute("""
diff --git a/addons/hr_evaluation/security/ir.model.access.csv b/addons/hr_evaluation/security/ir.model.access.csv
index 1f22e3b5d16..3fb1425651c 100644
--- a/addons/hr_evaluation/security/ir.model.access.csv
+++ b/addons/hr_evaluation/security/ir.model.access.csv
@@ -6,37 +6,20 @@ access_hr_evaluation_plan_phase_user,hr_evaluation.plan.phase.user,model_hr_eval
access_hr_evaluation_interview_user,hr.evaluation.interview.user,model_hr_evaluation_interview,base.group_hr_user,1,1,1,1
access_hr_evaluation_interview_employee,hr.evaluation.interview.employee,model_hr_evaluation_interview,base.group_user,1,1,1,0
access_hr_evaluation_report,hr.evaluation.report,model_hr_evaluation_report,base.group_hr_manager,1,1,1,1
-access_survey_type_hr_manager,survey.type,survey.model_survey_type,base.group_hr_manager,1,1,1,1
-access_survey_hr_manager,survey.hr.manager,survey.model_survey,base.group_hr_manager,1,1,1,1
-access_survey_history_manager,survey.history,survey.model_survey_history,base.group_hr_manager,1,1,1,1
+access_survey_hr_manager,survey.hr.manager,survey.model_survey_survey,base.group_hr_manager,1,1,1,1
access_survey_question_hr_manager,survey.question,survey.model_survey_question,base.group_hr_manager,1,1,1,1
-access_survey_question_column_heading_hr_manager,survey.question.column.heading,survey.model_survey_question_column_heading,base.group_hr_manager,1,1,1,1
-access_survey_answer_hr_manager,survey.answer,survey.model_survey_answer,base.group_hr_manager,1,1,1,1
-access_survey_response_hr_manager,survey.response,survey.model_survey_response,base.group_hr_manager,1,1,1,1
-access_survey_response_line_hr_manager,survey.response.line,survey.model_survey_response_line,base.group_hr_manager,1,1,1,1
-access_survey_tbl_column_heading_hr_manager,survey.tbl.column.heading,survey.model_survey_tbl_column_heading,base.group_hr_manager,1,1,1,1
-access_survey_response_answer_hr_manager,survey.response.answer,survey.model_survey_response_answer,base.group_hr_manager,1,1,1,1
-access_survey_request_hr_manager,survey.request,survey.model_survey_request,base.group_hr_manager,1,1,1,1
-access_survey_answer_hr_user,survey.answer.hr.user,survey.model_survey_answer,base.group_hr_user,1,1,1,0
-access_survey_response_answer_hr_user,survey.response.answer.hr.user,survey.model_survey_response_answer,base.group_hr_user,1,1,1,0
-access_survey_type_hr_user,survey.type.hr.user,survey.model_survey_type,base.group_hr_user,1,1,1,0
+access_survey_question_column_heading_hr_manager,survey.question.column.heading,survey.model_survey_label,base.group_hr_manager,1,1,1,1
+access_survey_response_hr_manager,survey.response,survey.model_survey_user_input,base.group_hr_manager,1,1,1,1
+access_survey_response_line_hr_manager,survey.response.line,survey.model_survey_user_input_line,base.group_hr_manager,1,1,1,1
access_survey_question_hr_user,survey.question.hr.user,survey.model_survey_question,base.group_hr_user,1,1,1,0
access_survey_page_hr_user,survey.page.hr.user,survey.model_survey_page,base.group_hr_user,1,1,1,1
-access_survey_response_hr_user,survey.response.hr.user,survey.model_survey_response,base.group_hr_user,1,1,1,0
-access_survey_history_hr_user,survey.history.hr.user,survey.model_survey_history,base.group_hr_user,1,1,1,0
-access_survey_request_hr_user,survey.request.hr.user,survey.model_survey_request,base.group_hr_user,1,1,1,0
-access_survey_question_column_heading_hr_user,survey.question.column.heading.hr.user,survey.model_survey_question_column_heading,base.group_hr_user,1,1,1,0
-access_survey_response_line_hr_user,survey.response.line.hr.user,survey.model_survey_response_line,base.group_hr_user,1,1,1,0
-access_survey_tbl_column_heading_hr_user,survey.tbl.column.heading.hr.user,survey.model_survey_tbl_column_heading,base.group_hr_user,1,1,1,0
+access_survey_response_hr_user,survey.response.hr.user,survey.model_survey_user_input,base.group_hr_user,1,1,1,0
+access_survey_question_column_heading_hr_user,survey.question.column.heading.hr.user,survey.model_survey_label,base.group_hr_user,1,1,1,0
+access_survey_response_line_hr_user,survey.response.line.hr.user,survey.model_survey_user_input_line,base.group_hr_user,1,1,1,0
access_calendar_attendee_survey_user,base.calendar.calendar.attendee.survey.user,calendar.model_calendar_attendee,base.group_survey_user,1,1,1,0
-access_calendar_attendee_tool_user,base.calendar.calendar.attendee.tool.user,calendar.model_calendar_attendee,base.group_tool_user,1,1,1,0
-access_survey_request_hr_employee,survey.request.hr.employee,survey.model_survey_request,base.group_user,1,1,1,0
-access_survey_hr_employee,survey.hr.employee,survey.model_survey,base.group_user,1,1,0,0
+access_survey_hr_employee,survey.hr.employee,survey.model_survey_survey,base.group_user,1,1,0,0
access_survey_page_hr_employee,survey.page.hr.employee,survey.model_survey_page,base.group_user,1,0,0,0
-access_survey_answer_hr_employee,survey.answer.employee,survey.model_survey_answer,base.group_user,1,0,0,0
access_survey_question_hr_employee,survey.question.employee,survey.model_survey_question,base.group_user,1,0,0,0
-access_survey_response_hr_employee,survey.response.employee,survey.model_survey_response,base.group_user,1,1,1,0
-access_survey_question_column_heading_hr_employee,survey.question.column.heading.employee,survey.model_survey_question_column_heading,base.group_user,1,0,0,0
-access_survey_response_line_hr_employee,survey.response.line.employee,survey.model_survey_response_line,base.group_user,1,1,1,0
-access_survey_response_answer_hr_employee,survey.response.answer.hr.employee,survey.model_survey_response_answer,base.group_user,1,1,1,0
-access_survey_tbl_column_heading_hr_employee,survey.tbl.column.heading,survey.model_survey_tbl_column_heading,base.group_user,1,1,1,0
\ No newline at end of file
+access_survey_response_hr_employee,survey.response.employee,survey.model_survey_user_input,base.group_user,1,1,1,0
+access_survey_question_column_heading_hr_employee,survey.question.column.heading.employee,survey.model_survey_label,base.group_user,1,0,0,0
+access_survey_response_line_hr_employee,survey.response.line.employee,survey.model_survey_user_input_line,base.group_user,1,1,1,0
\ No newline at end of file
diff --git a/addons/hr_evaluation/survey_data_appraisal.xml b/addons/hr_evaluation/survey_data_appraisal.xml
new file mode 100644
index 00000000000..d3f83f91ba5
--- /dev/null
+++ b/addons/hr_evaluation/survey_data_appraisal.xml
@@ -0,0 +1,676 @@
+
+
+
+
+
+ Employee Appraisal Form
+
+ hr_evaluation
+
+
+ <p> </p>
+ <p> </p>
+
+
+
+ Employee Appraisal Form
+
+ 1
+ <h2>Overall Purpose Of Employee Appraisal</h2>
+<ul><li>To initiate a clear and open communication of performance expectations
+<li>To assist employees in their professional growth, through the identification of strengths and opportunities for
+development</ul>
+<h2>At the outset of the appraisal time period</h2>
+<ul><li>It is the joint responsibility of the employee and the supervisor (appraiser) to establish a feasible work plan for the
+coming year, including major employee responsibilities and corresponding benchmarks against which results will be
+evaluated.
+<li>Critical or key elements of performance and professional development needs (if any), should also be noted at this time</ul>
+<h2>At the conclusion of the appraisal time period</h2>
+<ul><li>The employee will be responsible for completing a draft of the Appraisal Form as a tool for self-appraisal and a starting
+point for the supervisor’s evaluation. The employee can add examples of achievements for each criterion.
+Once the form had been filled, the employee send it to his supervisor.
+<li>It is the primary responsibility of the supervisor to gather the necessary input from the appropriate sources of feedback
+(internal and/or external customers, peers). In case of collaboration with OpenERP SA Belgium, the supervisor must
+receive completed evaluation form from the employee's Belgian project manager.
+<li>The supervisor synthesizes and integrates all input into the completed appraisal. He motivates his evaluation in the ad
+hoc fields.
+<li>The employee may choose to offer comments or explanation regarding the completed review.
+<li>The supervisor send the form to the HR department in India and in Belgium</ul>
+
+
+
+ 1
+ Name
+ textbox
+
+
+
+
+ 2
+ Position Title
+ textbox
+
+
+
+
+ 3
+ Appraisal for Period
+ textbox
+
+
+
+
+ 4
+ Date of review
+ textbox
+
+
+
+
+ 5
+ Appraiser
+ textbox
+
+
+
+
+ Work Plan
+
+ 2
+ <p> </p>
+
+
+
+ 1
+ Objectives
+ free_text
+
+
+
+
+ 2
+ Results
+ free_text
+
+
+
+
+ 3
+ Additional Comments
+ free_text
+
+
+
+ Employee Performance in Key Areas
+
+ 3
+ The appraiser should rate the employee’s major work accomplishments and performance according to the metric provided
+below:<ol>
+<li> Significantly exceeds standards and expectations required of the position
+<li> Exceeds standards and expectations
+<li> Meet standards and expectations
+<li> Did not meet standards and expectations
+<li> Significantly below standards and expectations</ol>
+
+
+
+ 1
+ Subject
+ matrix
+ simple
+
+
+
+
+ 1
+ 1
+
+
+
+ 2
+ 2
+
+
+
+ 3
+ 3
+
+
+
+ 4
+ 4
+
+
+
+ 5
+ 5
+
+
+
+ 1
+ Ability to cope with multidisciplinarity of team
+
+
+
+ 2
+ Enthusiasm & implication toward projects/assignments
+
+
+
+ 3
+ Compliance to internal rules and processes (timesheets completion, etc.)
+
+
+
+ 4
+ Team spirit: ability to work efficiently with peers, manage the conflicts with diplomacy
+
+
+
+ 5
+ Initiative and self autonomy
+
+
+
+ 6
+ Ability to follow and complete work as instructed
+
+
+
+ 7
+ Decision making
+
+
+
+ 8
+ Customer commitment
+
+
+
+ 9
+ Communication skills (written & verbally): clearness, concision, exactitude
+
+
+
+ 10
+ Technical skills regarding to the job requirements
+
+
+
+ 11
+ Analytical and synthetic mind
+
+
+
+ 12
+ Promptness and attendance record
+
+
+
+ 13
+ Adaptability: Ability to adapt oneself to organizational changes while keeping efficiency
+
+
+
+ 14
+ Creativity and forward looking aptitude
+
+
+
+ 15
+ Time management: projects/tasks are completed on time
+
+
+
+ 2
+ Supervisors only
+ matrix
+ simple
+
+
+
+ 1
+ 1
+
+
+
+ 2
+ 2
+
+
+
+ 3
+ 3
+
+
+
+ 4
+ 4
+
+
+
+ 5
+ 5
+
+
+
+ 1
+ Results of the bottom-up survey and mitigation actions to face technical, organizational, structural and/or relational issues
+
+
+
+ 2
+ Delegation: Ability to efficiently assign tasks to other people
+
+
+
+ 3
+ Leadership: create a challenging and motivating work environment aligned with the company's strategy
+
+
+
+ 4
+ Leadership: sustain subordinates in their professional growth
+
+
+
+ 5
+ Ability to manage planning resources, risks, budgets and deadlines
+
+
+
+ Professional Development and Performance Plan
+
+ 4
+ <p>Identify professional, performance, or project objectives you recommend for employee’s continued career development
+over the coming year.</p>
+
+
+
+ 1
+ Professional Development Objectives
+ free_text
+
+
+
+ 2
+ Personal Performance Objectives
+ free_text
+
+
+
+ 3
+ Project Objectives
+ free_text
+
+
+
+ Employee Comments
+
+ <p></p>
+ 5
+
+
+
+ 1
+ Use the following space to make any comments regarding the above performance evaluation.
+ free_text
+
+
+
+ Employee Opinion Form
+
+ hr_evaluation
+
+
+ <p> </p>
+ <p> </p>
+
+
+
+ Appraisal Process
+
+ 1
+ <h2>At the supervisor's appraisal date</h2>
+<p>His direct reports will be invited through OpenERP to express a feedback on their supervisor's leadership and to give their opinion about their own engagement and effectiveness, the continuous improvement and openness in action in thecompany...</p>
+<p>The employees will send back their anonymous answers to OpenERP. The data will be handled by the HR manager and a brief summary of the data will be sent to the concerned supervisor, to his team and to the supervisor's supervisor.</p>
+<p>The appraiser should rate the employee's major work accomplishments and performance according to the metric provided below
+<ol>
+<li>Significantly exceeds standards and expectations required of the position</li>
+<li>Exceeds standards and expectations</li>
+<li>Meet standards and expectations</li>
+<li>Did not meet standards and expectations</li>
+<li>Significantly below standards and expectations</li>
+</ol></p>
+
+
+
+ 1
+ Name of your direct supervisor
+ textbox
+
+
+
+
+ 2
+ Date
+ textbox
+
+
+
+
+ Evaluation
+
+ 2
+ <p> </p>
+
+
+
+ 1
+ Engagement
+ matrix
+ simple
+
+
+
+ 1
+ 1
+
+
+
+ 2
+ 2
+
+
+
+ 3
+ 3
+
+
+
+ 4
+ 4
+
+
+
+ 5
+ 5
+
+
+
+ 1
+ I am proud to tell others I work here
+
+
+
+ 2
+ My job provides me with a sense of personal accomplishment
+
+
+
+ 3
+ I would prefer to remain with this company even if a comparable job were available in another company
+
+
+
+ 4
+ Taking everything into account, how satisfied are you with your current job?
+
+
+
+ 5
+ I am willing to put in a great deal of effort beyond what is expected to help my workgroup succeed
+
+
+
+ 2
+ Leadership
+ matrix
+ simple
+
+
+
+ 1
+ 1
+
+
+
+ 2
+ 2
+
+
+
+ 3
+ 3
+
+
+
+ 4
+ 4
+
+
+
+ 5
+ 5
+
+
+
+ 1
+ Demonstrates genuine concern for me as a person
+
+
+
+ 2
+ I consistently acquire new knowledge, skills or understanding through contact with my supervisor. He helps me growing my compete
+
+
+
+ 3
+ Listens and takes into account all ideas and do his best to put in place the best of these
+
+
+
+ 4
+ I believe the information that I get from the person I report to.
+
+
+
+ 3
+ Effectiveness
+ matrix
+ simple
+
+
+
+ 1
+ 1
+
+
+
+ 2
+ 2
+
+
+
+ 3
+ 3
+
+
+
+ 4
+ 4
+
+
+
+ 5
+ 5
+
+
+
+ 1
+ I'm efficient at work and my achievements are successful
+
+
+
+ 2
+ I have enough work
+
+
+
+ 3
+ I mostly work on value-added tasks for the company, the products or the services
+
+
+
+ 4
+ Continuous Improvement
+ matrix
+ simple
+
+
+
+ 1
+ 1
+
+
+
+ 2
+ 2
+
+
+
+ 3
+ 3
+
+
+
+ 4
+ 4
+
+
+
+ 5
+ 5
+
+
+
+ 1
+ My work contributes towards the continuous improvement of the company, our services or products
+
+
+
+ 2
+ What I did several months ago is still of use to the company, the services or the products today
+
+
+
+ 3
+ Overall, I believe the quality of products and/or services my workgroup delivers is improving
+
+
+
+ 4
+ Our workgroup identifies and reduces waste of time in our activities and processes
+
+
+
+ 5
+ Openness
+ matrix
+ simple
+
+
+
+ 1
+ 1
+
+
+
+ 2
+ 2
+
+
+
+ 3
+ 3
+
+
+
+ 4
+ 4
+
+
+
+ 5
+ 5
+
+
+
+ 1
+ I know the company's values and live them
+
+
+
+ 2
+ My best achievements have been communicated to the community, internally or to customers
+
+
+
+ 6
+ Miscellaneous
+ matrix
+ simple
+
+
+
+ 1
+ 1
+
+
+
+ 2
+ 2
+
+
+
+ 3
+ 3
+
+
+
+ 4
+ 4
+
+
+
+ 5
+ 5
+
+
+
+ 1
+ Actions by Executive management show genuine interest in the well-being of employees
+
+
+
+ 2
+ I have the same opportunity to succeed as others with similar experiences, performance and educational background
+
+
+
+ 3
+ Compared to similar jobs in other companies where I could work, my total compensation...
+
+
+
+ 4
+ I understand the company strategy and how my workgroup supports it
+
+
+
+ 7
+ Additional comments
+ free_text
+
+
+
diff --git a/addons/hr_evaluation/test/hr_evalution_demo.yml b/addons/hr_evaluation/test/hr_evalution_demo.yml
index 8c62969dea6..d6a7a327c66 100644
--- a/addons/hr_evaluation/test/hr_evalution_demo.yml
+++ b/addons/hr_evaluation/test/hr_evalution_demo.yml
@@ -1,6 +1,6 @@
--
- !record {model: hr.employee, id: hr.employee_fp, view: False}:
- evaluation_plan_id: hr_evaluation_plan_managersevaluationplan0
--
- !record {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0, view: False}:
- plan_id: hr_evaluation.hr_evaluation_plan_managersevaluationplan0
\ No newline at end of file
+# -
+# !record {model: hr.employee, id: hr.employee_fp, view: False}:
+# evaluation_plan_id: hr_evaluation_plan_managersevaluationplan0
+# -
+# !record {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0, view: False}:
+# plan_id: hr_evaluation.hr_evaluation_plan_managersevaluationplan0
\ No newline at end of file
diff --git a/addons/hr_evaluation/test/test_hr_evaluation.yml b/addons/hr_evaluation/test/test_hr_evaluation.yml
index 3244e37302e..d9d6c8edd49 100644
--- a/addons/hr_evaluation/test/test_hr_evaluation.yml
+++ b/addons/hr_evaluation/test/test_hr_evaluation.yml
@@ -1,108 +1,103 @@
--
- I set the "Employee Evaluation" survey in open state.
--
- !python {model: survey}: |
- self.survey_open(cr, uid, [ref("survey_2")], context)
--
- I check that state of "Employee Evaluation" survey is Open.
--
- !assert {model: survey, id: survey_2, severity: error, string: Survey should be in OPen state}:
- - state == 'open'
--
- I start the 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')])
--
- I check that state is "Plan in progress".
--
- !assert {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0, severity: error, string: Evaluation should be 'Plan in progress' state}:
- - state == 'wait'
--
- I find a mistake on evaluation form. So I cancel the evaluation and again start it.
--
- !python {model: hr_evaluation.evaluation}: |
- evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0') , context)
- self.button_cancel(cr, uid, [ref('hr_evaluation_evaluation_0')])
- assert evaluation.state == 'cancel', 'Evaluation should be in cancel state'
- self.button_draft(cr, uid, [ref('hr_evaluation_evaluation_0')])
- evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0') , context)
- assert evaluation.state == 'draft', 'Evaluation should be in draft state'
- self.button_plan_in_progress(cr, uid, [ref('hr_evaluation_evaluation_0')])
--
- I check that state is "Plan in progress" and "Interview Request" record is created
--
- !python {model: hr_evaluation.evaluation}: |
- interview_obj = self.pool.get('hr.evaluation.interview')
- evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0') , context)
- assert evaluation.state == 'wait', "Evaluation should be 'Plan in progress' state"
- interview_ids = interview_obj.search(cr, uid, [('evaluation_id','=', ref('hr_evaluation_evaluation_0'))])
- assert len(interview_ids), "Interview evaluation survey not created"
--
- Give answer of the first page in "Employee Evaluation" survey.
--
- !python {model: survey.question.wiz}: |
- name_wiz_obj=self.pool.get('survey.name.wiz')
- interview_obj = self.pool.get('hr.evaluation.interview')
- interview_ids = interview_obj.search(cr, uid, [('evaluation_id','=', ref('hr_evaluation_evaluation_0'))])
- assert len(interview_ids), "Interview evaluation survey not created"
- ctx = {'active_model':'hr.evaluation.interview', 'active_id': interview_ids[0], 'active_ids': [interview_ids], 'survey_id': ref("survey_2")}
- name_id = name_wiz_obj.create(cr, uid, {'survey_id': ref("survey_2")})
- ctx ["sur_name_id"] = name_id
- self.create(cr, uid, {str(ref("survey_question_2")) +"_" +str(ref("survey_answer_1")) + "_multi" :'tpa',
- str(ref("survey_question_2")) +"_" +str(ref("survey_answer_10")) + "_multi" :'application eng',
- str(ref("survey_question_2")) +"_" +str(ref("survey_answer_20")) + "_multi" :'3',
- str(ref("survey_question_2")) +"_" +str(ref("survey_answer_25")) + "_multi" :'2011-12-02 16:42:00',
- str(ref("survey_question_2")) +"_" +str(ref("survey_answer_43")) + "_multi" :'HR',
- }, context = ctx)
--
- I close this Evaluation survey by giving answer of questions.
--
- !python {model: hr_evaluation.evaluation}: |
- interview_obj = self.pool.get('hr.evaluation.interview')
- evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0'))
- interview_obj.survey_req_done(cr, uid, [r.id for r in evaluation.survey_request_ids])
- for survey in evaluation.survey_request_ids:
- interview = interview_obj.browse(cr, uid, survey.id, context)
- assert interview.state == "done", 'survey must be in done state'
--
- I print the evaluation.
--
- !python {model: hr_evaluation.evaluation}: |
- evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0'))
- self.pool.get('hr.evaluation.interview').action_print_survey(cr, uid, [r.id for r in evaluation.survey_request_ids])
--
- I click on "Final Validation" button to finalise evaluation.
--
- !python {model: hr_evaluation.evaluation}: |
- self.button_final_validation(cr, uid, [ref("hr_evaluation_evaluation_0")])
--
- I check that state is "Waiting Appreciation".
--
- !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_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_evaluation_0")])
--
- I check that state of Evaluation is done.
--
- !assert {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0, severity: error, string: Evaluation should be in done state}:
- - state == 'done'
--
- Print Evaluations Statistics Report
--
- !python {model: hr.evaluation.report}: |
- import os, time
- from openerp import tools
- ctx={}
- data_dict={'state': 'done', 'rating': 2, 'employee_id': ref("hr.employee_fp")}
- from openerp.tools import test_reports
- test_reports.try_report_action(cr, uid, 'hr_evaluation_evaluation_0',wiz_data=data_dict, context=ctx, our_module='hr_evaluation')
+# -
+# I check that state of "Employee Evaluation" survey is Open.
+# -
+# !assert {model: survey.survey, id: appraisal_form, severity: error, string: Survey should be in 'open' state}:
+# - state == 'open'
+# -
+# I start the 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')])
+# -
+# I check that state is "Plan in progress".
+# -
+# !assert {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0, severity: error, string: Evaluation should be 'Plan in progress' state}:
+# - state == 'wait'
+# -
+# I find a mistake on evaluation form. So I cancel the evaluation and again start it.
+# -
+# !python {model: hr_evaluation.evaluation}: |
+# evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0') , context)
+# self.button_cancel(cr, uid, [ref('hr_evaluation_evaluation_0')])
+# assert evaluation.state == 'cancel', 'Evaluation should be in cancel state'
+# self.button_draft(cr, uid, [ref('hr_evaluation_evaluation_0')])
+# evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0') , context)
+# assert evaluation.state == 'draft', 'Evaluation should be in draft state'
+# self.button_plan_in_progress(cr, uid, [ref('hr_evaluation_evaluation_0')])
+# -
+# I check that state is "Plan in progress" and "Interview Request" record is created
+# -
+# !python {model: hr_evaluation.evaluation}: |
+# interview_obj = self.pool.get('hr.evaluation.interview')
+# evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0') , context)
+# assert evaluation.state == 'wait', "Evaluation should be 'Plan in progress' state"
+# interview_ids = interview_obj.search(cr, uid, [('evaluation_id','=', ref('hr_evaluation_evaluation_0'))])
+# assert len(interview_ids), "Interview evaluation survey not created"
+# -
+# Give answer of the first page in "Employee Evaluation" survey.
+# -
+# !python {model: survey.question.wiz}: |
+# name_wiz_obj=self.pool.get('survey.name.wiz')
+# interview_obj = self.pool.get('hr.evaluation.interview')
+# interview_ids = interview_obj.search(cr, uid, [('evaluation_id','=', ref('hr_evaluation_evaluation_0'))])
+# assert len(interview_ids), "Interview evaluation survey not created"
+# ctx = {'active_model':'hr.evaluation.interview', 'active_id': interview_ids[0], 'active_ids': [interview_ids], 'survey_id': ref("survey_2")}
+# name_id = name_wiz_obj.create(cr, uid, {'survey_id': ref("survey_2")})
+# ctx ["sur_name_id"] = name_id
+# self.create(cr, uid, {str(ref("survey_question_2")) +"_" +str(ref("survey_answer_1")) + "_multi" :'tpa',
+# str(ref("survey_question_2")) +"_" +str(ref("survey_answer_10")) + "_multi" :'application eng',
+# str(ref("survey_question_2")) +"_" +str(ref("survey_answer_20")) + "_multi" :'3',
+# str(ref("survey_question_2")) +"_" +str(ref("survey_answer_25")) + "_multi" :'2011-12-02 16:42:00',
+# str(ref("survey_question_2")) +"_" +str(ref("survey_answer_43")) + "_multi" :'HR',
+# }, context = ctx)
+# -
+# I close this Evaluation survey by giving answer of questions.
+# -
+# !python {model: hr_evaluation.evaluation}: |
+# interview_obj = self.pool.get('hr.evaluation.interview')
+# evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0'))
+# interview_obj.survey_req_done(cr, uid, [r.id for r in evaluation.survey_request_ids])
+# for survey in evaluation.survey_request_ids:
+# interview = interview_obj.browse(cr, uid, survey.id, context)
+# assert interview.state == "done", 'survey must be in done state'
+# -
+# I print the evaluation.
+# -
+# !python {model: hr_evaluation.evaluation}: |
+# evaluation = self.browse(cr, uid, ref('hr_evaluation_evaluation_0'))
+# self.pool.get('hr.evaluation.interview').action_print_survey(cr, uid, [r.id for r in evaluation.survey_request_ids])
+# -
+# I click on "Final Validation" button to finalise evaluation.
+# -
+# !python {model: hr_evaluation.evaluation}: |
+# self.button_final_validation(cr, uid, [ref("hr_evaluation_evaluation_0")])
+# -
+# I check that state is "Waiting Appreciation".
+# -
+# !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_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_evaluation_0")])
+# -
+# I check that state of Evaluation is done.
+# -
+# !assert {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0, severity: error, string: Evaluation should be in done state}:
+# - state == 'done'
+# -
+# Print Evaluations Statistics Report
+# -
+# !python {model: hr.evaluation.report}: |
+# import os, time
+# from openerp import tools
+# ctx={}
+# data_dict={'state': 'done', 'rating': 2, 'employee_id': ref("hr.employee_fp")}
+# from openerp.tools import test_reports
+# test_reports.try_report_action(cr, uid, 'hr_evaluation_evaluation_0',wiz_data=data_dict, context=ctx, our_module='hr_evaluation')
diff --git a/addons/hr_recruitment/__openerp__.py b/addons/hr_recruitment/__openerp__.py
index e6c94b4245f..27c7d194b74 100644
--- a/addons/hr_recruitment/__openerp__.py
+++ b/addons/hr_recruitment/__openerp__.py
@@ -25,7 +25,7 @@
'version': '1.0',
'category': 'Human Resources',
'sequence': 25,
- 'summary': 'Jobs, Recruitment, Applications, Job Interviews',
+ 'summary': 'Jobs, Recruitment, Applications, Job Interviews, Surveys',
'description': """
Manage job positions and the recruitment process
================================================
@@ -37,7 +37,8 @@ You can define the different phases of interviews and easily rate the applicant
""",
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
- 'images': ['images/hr_recruitment_analysis.jpeg','images/hr_recruitment_applicants.jpeg','static/src/img/down1.png'],
+ 'images': ['images/hr_recruitment_analysis.jpeg',
+ 'images/hr_recruitment_applicants.jpeg'],
'depends': [
'decimal_precision',
'hr',
@@ -56,6 +57,7 @@ You can define the different phases of interviews and easily rate the applicant
'board_hr_recruitment_statistical_view.xml',
'hr_recruitment_installer_view.xml',
'res_config_view.xml',
+ 'survey_data_recruitment.xml',
'hr_recruitment_data.xml',
],
'demo': ['hr_recruitment_demo.xml'],
@@ -63,10 +65,8 @@ You can define the different phases of interviews and easily rate the applicant
'static/src/js/job_position.js',
],
'test': ['test/recruitment_process.yml'],
- 'css':['static/src/css/job_position.css'],
+ 'css': ['static/src/css/job_position.css'],
'installable': True,
'auto_install': False,
'application': True,
}
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py
index 20e9e0930cc..ac11ef5e81d 100644
--- a/addons/hr_recruitment/hr_recruitment.py
+++ b/addons/hr_recruitment/hr_recruitment.py
@@ -211,8 +211,8 @@ class hr_applicant(osv.Model):
'partner_mobile': fields.char('Mobile', size=32),
'type_id': fields.many2one('hr.recruitment.degree', 'Degree'),
'department_id': fields.many2one('hr.department', 'Department'),
- 'survey': fields.related('job_id', 'survey_id', type='many2one', relation='survey', string='Survey'),
- 'response': fields.integer("Response"),
+ 'survey': fields.related('job_id', 'survey_id', type='many2one', relation='survey.survey', string='Survey'),
+ 'response_id': fields.many2one('survey.user_input', "Response", ondelete='set null', oldname="response"),
'reference': fields.char('Referred By', size=128),
'source_id': fields.many2one('hr.recruitment.source', 'Source'),
'day_open': fields.function(_compute_day, string='Days to Open', \
@@ -311,24 +311,34 @@ class hr_applicant(osv.Model):
}
return res
- def action_print_survey(self, cr, uid, ids, context=None):
- """
- If response is available then print this response otherwise print survey form(print template of the survey).
+ def action_start_survey(self, cr, uid, ids, context=None):
+ context = context if context else {}
+ applicant = self.browse(cr, uid, ids, context=context)[0]
+ survey_obj = self.pool.get('survey.survey')
+ response_obj = self.pool.get('survey.user_input')
+ # create a response and link it to this applicant
+ if not applicant.response_id:
+ response_id = response_obj.create(cr, uid, {'survey_id': applicant.survey.id, 'partner_id': applicant.partner_id.id}, context=context)
+ self.write(cr, uid, ids[0], {'response_id': response_id}, context=context)
+ else:
+ response_id = applicant.response_id.id
+ # grab the token of the response and start surveying
+ response = response_obj.browse(cr, uid, response_id, context=context)
+ context.update({'survey_token': response.token})
+ return survey_obj.action_start_survey(cr, uid, [applicant.survey.id], context=context)
- @param self: The object pointer
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of Survey IDs
- @param context: A standard dictionary for contextual values
- @return: Dictionary value for print survey form.
- """
- if context is None:
- context = {}
- record = self.browse(cr, uid, ids, context=context)
- record = record and record[0]
- context.update({'survey_id': record.survey.id, 'response_id': [record.response], 'response_no': 0, })
- value = self.pool.get("survey").action_print_survey(cr, uid, ids, context=context)
- return value
+ def action_print_survey(self, cr, uid, ids, context=None):
+ """ If response is available then print this response otherwise print survey form (print template of the survey) """
+ context = context if context else {}
+ applicant = self.browse(cr, uid, ids, context=context)[0]
+ survey_obj = self.pool.get('survey.survey')
+ response_obj = self.pool.get('survey.user_input')
+ if not applicant.response_id:
+ return survey_obj.action_print_survey(cr, uid, [applicant.survey.id], context=context)
+ else:
+ response = response_obj.browse(cr, uid, applicant.response_id.id, context=context)
+ context.update({'survey_token': response.token})
+ return survey_obj.action_print_survey(cr, uid, [applicant.survey.id], context=context)
def action_get_attachment_tree_view(self, cr, uid, ids, context=None):
model, action_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'base', 'action_attachment')
@@ -391,9 +401,9 @@ class hr_applicant(osv.Model):
ids = [ids]
res = True
- # user_id change: update date_start
+ # user_id change: update date_open
if vals.get('user_id'):
- vals['date_start'] = fields.datetime.now()
+ vals['date_open'] = fields.datetime.now()
# stage_id: track last stage before update
if 'stage_id' in vals:
vals['date_last_stage_update'] = fields.datetime.now()
@@ -518,7 +528,7 @@ class hr_job(osv.osv):
return res
_columns = {
- 'survey_id': fields.many2one('survey', 'Interview Form', help="Choose an interview form for this job position and you will be able to print/answer this interview from all applicants who apply for this job"),
+ 'survey_id': fields.many2one('survey.survey', 'Interview Form', help="Choose an interview form for this job position and you will be able to print/answer this interview from all applicants who apply for this job"),
'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="restrict", required=True,
help="Email alias for this job position. New emails will automatically "
"create new applicants for this job position."),
@@ -559,21 +569,9 @@ class hr_job(osv.osv):
return res
def action_print_survey(self, cr, uid, ids, context=None):
- if context is None:
- context = {}
- datas = {}
- record = self.browse(cr, uid, ids, context=context)[0]
- if record.survey_id:
- datas['ids'] = [record.survey_id.id]
- datas['model'] = 'survey.print'
- context.update({'response_id': [0], 'response_no': 0})
- return {
- 'type': 'ir.actions.report.xml',
- 'report_name': 'survey.form',
- 'datas': datas,
- 'context': context,
- 'nodestroy': True,
- }
+ job = self.browse(cr, uid, ids, context=context)[0]
+ survey_id = job.survey_id.id
+ return self.pool.get('survey.survey').action_print_survey(cr, uid, [survey_id], context=context)
def action_get_attachment_tree_view(self, cr, uid, ids, context=None):
#open attachments of job and related applicantions.
diff --git a/addons/hr_recruitment/hr_recruitment_data.xml b/addons/hr_recruitment/hr_recruitment_data.xml
index 8a88d8ebe5f..5849a67d949 100644
--- a/addons/hr_recruitment/hr_recruitment_data.xml
+++ b/addons/hr_recruitment/hr_recruitment_data.xml
@@ -118,379 +118,6 @@
-
- Job Survey
- 20
-
-
-
- 5
-
-
- Default Section
-
-
-
-
- Education & Activities
-
-
-
-
- Importance
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- From which university will you graduate?
-
- single_textbox
- The comment you entered is in an invalid format.
-
-
-
- Other
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- Rate the Importance
-
- matrix_of_choices_only_one_ans
- The comment you entered is in an invalid format.
-
-
-
- Other
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- Education
-
- comment
- The comment you entered is in an invalid format.
-
-
-
- Other
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- Knowledge
-
- comment
- The comment you entered is in an invalid format.
-
-
-
- Other
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- What is your gender?
-
- multiple_choice_only_one_ans
- The comment you entered is in an invalid format.
-
-
-
- Other
-
-
-
-
-
- 1
- Male
-
-
-
-
-
- 1
- Female
-
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- What age group do you belong to?
-
- multiple_choice_only_one_ans
- The comment you entered is in an invalid format.
-
-
-
- Other
-
-
-
-
-
- 1
- 0 - 15
-
-
-
-
- 1
- 16 - 20
-
-
-
-
- 1
- 21 - 30
-
-
-
-
- 1
- 31 - 40
-
-
-
-
- 1
- 41 - 50
-
-
-
-
- 1
- 51 - 60
-
-
-
-
- 1
- 61 - 70
-
-
-
-
- 1
- 71 +
-
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- Experience
-
- comment
- The comment you entered is in an invalid format.
-
-
-
- Other
-
-
-
-
- 1
- do_not_validate
- do_not_validate
- Please enter a comment.
- The choices need to add up to [enter sum here].
-
- The comment you entered is in an invalid format.
-
- This question requires an answer.
-
- Activities
-
- comment
- The comment you entered is in an invalid format.
-
-
-
- Other
-
-
-
-
-
- Not important
-
-
-
-
-
- Somewhat important
-
-
-
-
-
- Important
-
-
-
-
-
- Very important
-
-
-
-
-
- Most important
-
-
-
-
- 1
- Good pay
-
-
-
-
- 1
- Getting on with colleagues
-
-
-
-
- 1
- Office environment (décor, light, space etc)
-
-
-
-
- 1
- Desk space
-
-
-
-
- 1
- State of the art technology
-
-
-
-
- 1
- Office location (proximity to home)
-
-
-
-
- 1
- Good management/boss
-
-
-
-
- 1
- Freebies such as tea, coffee and stationery
-
-
-
-
- 1
- Perks such as free parking, gym passes etc
-
-
-
-
- 1
- No out of hours working
-
-
-
-
- 1
- Dress code
-
-
-
-
- 1
- Regular meetings
-
-
-
-
- 1
- Good social life (office nights out, good Christmas parties etc)
-
-
-
-
jobs
diff --git a/addons/hr_recruitment/hr_recruitment_demo.xml b/addons/hr_recruitment/hr_recruitment_demo.xml
index 8ba49a2beb8..3d6c05c1489 100644
--- a/addons/hr_recruitment/hr_recruitment_demo.xml
+++ b/addons/hr_recruitment/hr_recruitment_demo.xml
@@ -126,35 +126,35 @@
recruit4
-
+
-
+
-
+ recruit1
-
+ 1recruit
-
+ recruit3
-
+ recruit6
-
+
-
+ -->
hr.applicant
diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml
index c9dc0d04ffb..53e35ea58d1 100644
--- a/addons/hr_recruitment/hr_recruitment_view.xml
+++ b/addons/hr_recruitment/hr_recruitment_view.xml
@@ -54,7 +54,7 @@
-
+
@@ -76,9 +76,9 @@
@@ -318,7 +318,7 @@
process and follow up all operations: meetings, interviews, etc.
Applicants and their attached CV are created automatically when an email is sent.
- If you install the document management modules, all resumes are indexed automatically,
+ If you install the document management modules, all resumes are indexed automatically,
so that you can easily search through their content.
- Click here to create a new job or remove the filter on "In Recruitment" to recruit for an on hold job.
+ Click here to create a new job or remove the filter on "In Recruitment" to recruit for an on hold job.
Define job position profile and manage recruitment in a context of a particular job: print interview survey, define number of expected new employees, and manage its recruitment pipe
diff --git a/addons/hr_recruitment/security/ir.model.access.csv b/addons/hr_recruitment/security/ir.model.access.csv
index 3cc92705a15..9cd9897a51b 100644
--- a/addons/hr_recruitment/security/ir.model.access.csv
+++ b/addons/hr_recruitment/security/ir.model.access.csv
@@ -4,7 +4,7 @@ access_hr_recruitment_report,hr.recruitment.report,model_hr_recruitment_report,b
access_hr_recruitment_stage_user,hr.recruitment.stage.user,model_hr_recruitment_stage,base.group_hr_user,1,1,1,1
access_hr_recruitment_degree,hr.recruitment.degree,model_hr_recruitment_degree,base.group_hr_user,1,1,1,1
access_res_partner_hr_user,res.partner.user,base.model_res_partner,base.group_hr_user,1,1,1,1
-access_survey_hr_user,survey.hr.user,survey.model_survey,base.group_hr_user,1,1,1,0
+access_survey_hr_user,survey.hr.user,survey.model_survey_survey,base.group_hr_user,1,1,1,0
access_calendar_event_hruser,calendar.event.hruser,calendar.model_calendar_event,base.group_hr_user,1,1,1,1
access_hr_recruitment_source_hr_officer,hr.recruitment.source,model_hr_recruitment_source,base.group_hr_user,1,1,1,1
access_hr_recruitment_source_all,hr.recruitment.source,model_hr_recruitment_source,,1,0,0,0
diff --git a/addons/hr_recruitment/static/src/js/job_position.js b/addons/hr_recruitment/static/src/js/job_position.js
index 06e880cb40d..43150117115 100644
--- a/addons/hr_recruitment/static/src/js/job_position.js
+++ b/addons/hr_recruitment/static/src/js/job_position.js
@@ -1,4 +1,5 @@
openerp.hr_recruitment = function (openerp) {
+ "use strict";
openerp.web_kanban.KanbanRecord.include({
on_card_clicked: function() {
@@ -10,4 +11,4 @@ openerp.hr_recruitment = function (openerp) {
},
});
-}
\ No newline at end of file
+};
diff --git a/addons/hr_recruitment/survey_data_recruitment.xml b/addons/hr_recruitment/survey_data_recruitment.xml
new file mode 100644
index 00000000000..f6aacb0f23c
--- /dev/null
+++ b/addons/hr_recruitment/survey_data_recruitment.xml
@@ -0,0 +1,230 @@
+
+
+
+
+
+ Recruitment Form
+
+ hr_recruitment
+
+
+ <p>This form is intended to help the responsible of a recruitment interview.</p>
+ <p></p>
+
+
+
+ Basic information
+
+ 1
+ <p></p>
+
+
+
+ 1
+ From which university will you graduate?
+ textbox
+
+
+
+ 2
+ What is your gender?
+ simple_choice
+ dropdown
+
+
+
+ 1
+ Male
+
+
+
+ 2
+ Female
+
+
+
+ 3
+ What age group do you belong to?
+ simple_choice
+ columns
+ 4
+
+
+
+ 1
+ 0-15
+
+
+
+ 2
+ 16-20
+
+
+
+ 3
+ 21-30
+
+
+
+
+ 4
+ 31-40
+
+
+
+ 5
+ 41-50
+
+
+
+ 6
+ 51-60
+
+
+
+ 7
+ 61-70
+
+
+
+ 8
+ 71+
+
+
+
+ Education and Activities
+
+ 2
+ <p></p>
+
+
+
+ 1
+ Knowledge
+ free_text
+
+
+
+ 2
+ Education
+ free_text
+
+
+
+ 3
+ Experience
+ free_text
+
+
+
+ 4
+ Activities
+ free_text
+
+
+
+ Importance
+
+ 3
+ <p></p>
+
+
+
+ 1
+ Rate the Importance
+ matrix
+ simple
+
+
+
+ 1
+ Not important
+
+
+
+ 2
+ Somewhat important
+
+
+
+ 3
+ Important
+
+
+
+ 4
+ Very important
+
+
+
+ 5
+ Most important
+
+
+
+
+ 1
+ Good pay
+
+
+
+ 2
+ Getting on with colleagues
+
+
+
+ 3
+ Office environment
+
+
+
+ 4
+ Desk space
+
+
+
+ 5
+ State of the art technology
+
+
+
+ 6
+ Office location
+
+
+
+ 7
+ Good management
+
+
+
+ 8
+ Freebies such as tea, coffee and stationery
+
+
+
+ 9
+ Perks such as free parking, gym passes
+
+
+
+ 10
+ No out of hours working
+
+
+
+ 11
+ Dress code
+
+
+
+ 12
+ Regular meetings
+
+
+
+ 13
+ Good social life
+
+
+
diff --git a/addons/hr_recruitment/test/recruitment_process.yml b/addons/hr_recruitment/test/recruitment_process.yml
index 8588e5c96e8..85abad2a9d6 100644
--- a/addons/hr_recruitment/test/recruitment_process.yml
+++ b/addons/hr_recruitment/test/recruitment_process.yml
@@ -47,16 +47,6 @@
-
!python {model: hr.applicant}: |
self.action_makeMeeting(cr, uid, [ref('hr_case_programmer')])
--
- Applicant fillup the answer of the interview quetion.
--
- !python {model: survey.question.wiz}: |
- ctx = context.copy()
- ctx.update({'active_model': 'hr.applicant', 'active_id': ref("hr_case_programmer"), 'active_ids': [ref("hr_case_programmer")], 'survey_id': ref("survey_job_0")})
- self.fields_view_get(cr, uid, ref("survey.view_survey_question_message"),"form", context=ctx)
- vals = self.default_get(cr, uid , [], context=ctx)
- self.create(cr, uid, vals, context=ctx)
- self.action_new_page(cr, uid, [ref("survey_job_0")], context=ctx)
-
I print Applicant fill up the interview quetion
-
diff --git a/addons/hw_escpos/controllers/main.py b/addons/hw_escpos/controllers/main.py
index 938fa064d52..57fba3a4191 100644
--- a/addons/hw_escpos/controllers/main.py
+++ b/addons/hw_escpos/controllers/main.py
@@ -3,6 +3,7 @@ import commands
import logging
import simplejson
import os
+import os.path
import io
import base64
import openerp
@@ -11,6 +12,8 @@ import random
import math
import md5
import openerp.addons.hw_proxy.controllers.main as hw_proxy
+import pickle
+import re
import subprocess
import traceback
from threading import Thread, Lock
@@ -45,10 +48,58 @@ class EscposDriver(Thread):
self.lock = Lock()
self.status = {'status':'connecting', 'messages':[]}
+ def supported_devices(self):
+ if not os.path.isfile('escpos_devices.pickle'):
+ return supported_devices.device_list
+ else:
+ try:
+ f = open('escpos_devices.pickle','r')
+ return pickle.load(f)
+ f.close()
+ except Exception as e:
+ self.set_status('error',str(e))
+ return supported_devices.device_list
+
+ def add_supported_device(self,device_string):
+ r = re.compile('[0-9A-Fa-f]{4}:[0-9A-Fa-f]{4}');
+ match = r.search(device_string)
+ if match:
+ match = match.group().split(':')
+ vendor = int(match[0],16)
+ product = int(match[1],16)
+ name = device_string.split('ID')
+ if len(name) >= 2:
+ name = name[1]
+ else:
+ name = name[0]
+ _logger.info('ESC/POS: adding support for device: '+match[0]+':'+match[1]+' '+name)
+
+ device_list = supported_devices.device_list[:]
+ if os.path.isfile('escpos_devices.pickle'):
+ try:
+ f = open('escpos_devices.pickle','r')
+ device_list = pickle.load(f)
+ f.close()
+ except Exception as e:
+ self.set_status('error',str(e))
+ device_list.append({
+ 'vendor': vendor,
+ 'product': product,
+ 'name': name,
+ })
+
+ try:
+ f = open('escpos_devices.pickle','w+')
+ f.seek(0)
+ pickle.dump(device_list,f)
+ f.close()
+ except Exception as e:
+ self.set_status('error',str(e))
+
def connected_usb_devices(self):
connected = []
- for device in supported_devices.device_list:
+ for device in self.supported_devices():
if usb.core.find(idVendor=device['vendor'], idProduct=device['product']) != None:
connected.append(device)
return connected
@@ -83,8 +134,9 @@ class EscposDriver(Thread):
printer.cashdraw(5)
def set_status(self, status, message = None):
+ _logger.info(status+' : '+ (message or 'no message'))
if status == self.status['status']:
- if message != None and message != self.status['messages'][-1]:
+ if message != None and (len(self.status['messages']) == 0 or message != self.status['messages'][-1]):
self.status['messages'].append(message)
else:
self.status['status'] = status
@@ -307,7 +359,22 @@ class EscposProxy(hw_proxy.Proxy):
driver.push_task('receipt',receipt)
@http.route('/hw_proxy/print_xml_receipt', type='json', auth='none', cors='*')
- def print_receipt(self, receipt):
+ def print_xml_receipt(self, receipt):
_logger.info('ESC/POS: PRINT XML RECEIPT')
driver.push_task('xml_receipt',receipt)
+
+ @http.route('/hw_proxy/escpos/add_supported_device', type='http', auth='none', cors='*')
+ def add_supported_device(self, device_string):
+ _logger.info('ESC/POS: ADDED NEW DEVICE:'+device_string)
+ driver.add_supported_device(device_string)
+ return "The device:\n"+device_string+"\n has been added to the list of supported devices. Ok"
+
+ @http.route('/hw_proxy/escpos/reset_supported_devices', type='http', auth='none', cors='*')
+ def reset_supported_devices(self):
+ try:
+ os.remove('escpos_devices.pickle')
+ except Exception as e:
+ pass
+ return 'The list of supported devices has been reset to factory defaults. Ok'
+
diff --git a/addons/hw_proxy/controllers/main.py b/addons/hw_proxy/controllers/main.py
index 9e94e4817a4..ea9b45c1b35 100644
--- a/addons/hw_proxy/controllers/main.py
+++ b/addons/hw_proxy/controllers/main.py
@@ -97,6 +97,22 @@ class Proxy(http.Controller):
device_name = device[device.find('ID')+2:]
resp+= "
"+device_name+"
\n"
resp += "
\n"
+ resp += """
+
Add New Printer
+
+ Copy and paste your printer's device description in the form below. You can find
+ your printer's description in the device list above. If you find that your printer works
+ well, please send your printer's description to
+ support@openerp.com so that we can add it to the default list of supported devices.
+