[MER] Merging upstream work

bzr revid: rim@openerp.com-20131021120311-2qfgftldcmbm640k
This commit is contained in:
Richard Mathot (OpenERP)
2013-10-21 14:03:11 +02:00
17 changed files with 197 additions and 131 deletions
-1
View File
@@ -40,7 +40,6 @@ If you need to manage your meetings, you should install the CRM module.
'website': 'http://www.openerp.com',
'demo': ['crm_meeting_demo.xml'],
'data': [
'security/calendar_security.xml',
'security/ir.model.access.csv',
'base_calendar_view.xml',
'crm_meeting_view.xml',
@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="0">
<record model="res.groups" id="base.group_survey_user">
<field name="name">Survey / User</field>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
</data>
</openerp>
@@ -4,7 +4,6 @@ access_calendar_alarm,calendar.alarm,model_calendar_alarm,base.group_user,1,1,1,
access_res_alarm,res.alarm,model_res_alarm,base.group_user,1,1,1,1
access_calendar_todo,calendar.todo,model_calendar_todo,base.group_user,1,1,1,1
access_calendar_event,calendar.event,model_calendar_event,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_crm_meeting_manager,crm.meeting.manager,model_crm_meeting,base.group_sale_manager,1,1,1,1
access_crm_meeting,crm.meeting,model_crm_meeting,base.group_sale_salesman,1,1,1,0
access_crm_meeting_all,crm.meeting_allll,model_crm_meeting,base.group_user,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
4 access_res_alarm res.alarm model_res_alarm base.group_user 1 1 1 1
5 access_calendar_todo calendar.todo model_calendar_todo base.group_user 1 1 1 1
6 access_calendar_event calendar.event model_calendar_event 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
7 access_crm_meeting_manager crm.meeting.manager model_crm_meeting base.group_sale_manager 1 1 1 1
8 access_crm_meeting crm.meeting model_crm_meeting base.group_sale_salesman 1 1 1 0
9 access_crm_meeting_all crm.meeting_allll model_crm_meeting base.group_user 1 0 0 0
+98 -71
View File
@@ -27,6 +27,7 @@ import time
from openerp.osv import fields, osv
from openerp.tools.translate import _
class hr_evaluation_plan(osv.osv):
_name = "hr_evaluation.plan"
_description = "Appraisal Plan"
@@ -42,10 +43,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):
_name = "hr_evaluation.plan.phase"
_description = "Appraisal Plan Phase"
@@ -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', '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('char')
}
_defaults = {
'sequence': 1,
'email_subject': _('''Regarding '''),
'mail_body': lambda *a:_('''
'mail_body': lambda *a: _('''
Date: %(date)s
Dear %(employee_name)s,
@@ -98,24 +99,26 @@ Thanks,
}
class hr_employee(osv.osv):
_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):
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)
@@ -123,6 +126,7 @@ class hr_employee(osv.osv):
obj_evaluation.button_plan_in_progress(cr, uid, [plan_id], context=context)
return True
class hr_evaluation(osv.osv):
_name = "hr_evaluation.evaluation"
_inherit = "mail.thread"
@@ -133,28 +137,27 @@ class hr_evaluation(osv.osv):
'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"),
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 bellow expectations'),
('1', 'Did 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'),
'interview_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',
}
@@ -179,7 +182,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 = {}
@@ -196,12 +198,16 @@ class hr_evaluation(osv.osv):
children = [evaluation.employee_id]
for child in children:
if (not child.user_id or not child.user_id.partner_id.id) and not child.work_email:
raise osv.except_osv(_('Warning!'), _('%s have not related user name and have no email address.' % child.name))
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'),
'user_id': child.user_id.id,
'user_to_review_id': evaluation.employee_id.id
'date_deadline': datetime.now() + relativedelta(months=1),
'email': child.work_email or None,
'user_to_review_id': evaluation.employee_id.id,
'response_type': 'link',
}, context=context)
if phase.wait:
wait = True
@@ -210,7 +216,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',
@@ -220,32 +226,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.interview_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."))
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')
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)
interview_obj = self.pool.get('hr.evaluation.interview')
evaluation = self.browse(cr, uid, ids[0], context=context)
interview_obj.action_cancel(cr, uid, [r.id for r in evaluation.interview_ids], 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):
@@ -254,9 +260,9 @@ class hr_evaluation(osv.osv):
if context is None:
context = {}
default = default.copy()
default['survey_request_ids'] = []
default['interview_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)
@@ -266,72 +272,93 @@ class hr_evaluation(osv.osv):
new_vals = {'date_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 survey_req in evalutation.interview_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"
_inherit = "survey.response"
_columns = {
'is_evaluation': fields.boolean('Is Appraisal?'),
}
class hr_evaluation_interview(osv.osv):
_name = 'hr.evaluation.interview'
_inherits = {'survey.request': 'request_id'}
_inherit = 'mail.thread'
_rec_name = 'request_id'
_inherits = {'survey.response': 'response_id'}
_inherit = ['mail.thread', 'ir.needaction_mixin']
_rec_name = 'response_id'
_description = 'Appraisal Interview'
_columns = {
'request_id': fields.many2one('survey.request','Request_id', ondelete='cascade', required=True),
'response_id': fields.many2one('survey.response', 'interview_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'),
'user_id': fields.many2one('res.users', 'Interviewer'),
}
_defaults = {
'is_evaluation': True,
}
def action_survey_resent(self, cr, uid, ids, context=None):
record = self.browse(cr, uid, ids[0], context=context)
return self.pool.get('survey.response').action_survey_resent(cr, uid, [record.response_id.id], context=context)
def action_print_response(self, cr, uid, ids, context=None):
record = self.browse(cr, uid, ids[0], context=context)
return self.pool.get('survey.response').action_print_response(cr, uid, [record.response_id.id], context=context)
def action_preview(self, cr, uid, ids, context=None):
record = self.browse(cr, uid, ids[0], context=context)
return self.pool.get('survey.response').action_preview(cr, uid, [record.response_id.id], context=context)
def action_cancel(self, cr, uid, ids, context=None):
record = self.browse(cr, uid, ids[0], context=context)
return self.pool.get('survey.response').action_cancel(cr, uid, [record.response_id.id], context=context)
def action_fill(self, cr, uid, ids, context=None):
action = self.action_preview(cr, uid, ids, context=context)
action['context']['readonly'] = False
return action
def _needaction_domain_get(self, cr, uid, context=None):
return ['|',
'&', ('state', '=', 'done'), ('user_id', '=', uid),
'&', ('state', 'in', ['new', 'skip']), ('user_to_review_id.user_id', '=', uid)]
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.response_id.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)
self.write(cr, uid, ids, {'state': 'new'}, 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):
for interview 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
if not interview.evaluation_id.id:
raise osv.except_osv(_('Warning!'), _("You cannot start evaluation without Appraisal."))
records = hr_eval_obj.browse(cr, uid, [interview.evaluation_id.id], context=context)[0].interview_ids
for child in records:
if child.state == "draft":
if child.state == "new":
wating_id = child.id
continue
if child.state != "done":
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)
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': 'done'}, context=context)
return True
def action_print_survey(self, cr, uid, ids, context=None):
@@ -349,7 +376,7 @@ class hr_evaluation_interview(osv.osv):
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,})
context.update({'survey_id': record.survey_id.id, 'response_id': [record.response_id.id], 'response_no': 0})
value = self.pool.get("survey").action_print_survey(cr, uid, ids, context=context)
return value
+7 -6
View File
@@ -16,14 +16,17 @@
<field name="body"><![CDATA[<p>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.</p>]]></field>
</record>
<record model="survey.type" id="survey_type_hr_evaluation">
<field name="name">Human Resources</field>
</record>
<record id="survey_2" model="survey">
<field name="title">Self Appraisal</field>
<field name="max_response_limit">20</field>
<field eval="[(6,0,[])]" name="users"/>
<field name="type" ref="survey.survey_type1"/>
<field name="type" ref="survey_type_hr_evaluation"/>
<field name="responsible_id" ref="base.user_root"/>
<field name="response_user">5</field>
<field name="state">open</field>
<field name="sign_in">1</field>
</record>
<record id="survey_page_1" model="survey.page">
<field name="title">Employee Appraisal Form</field>
@@ -606,10 +609,8 @@ Once the form had been filled, the employee send it to his supervisor.
<record id="survey_3" model="survey">
<field name="title">Employee Opinion</field>
<field name="max_response_limit">20</field>
<field eval="[(6,0,[])]" name="users"/>
<field name="type" ref="survey.survey_type1"/>
<field name="type" ref="survey_type_hr_evaluation"/>
<field name="responsible_id" ref="base.user_root"/>
<field name="response_user">5</field>
</record>
<record id="survey_page_2" model="survey.page">
<field name="title">Process</field>
@@ -32,7 +32,7 @@ class hr_evaluation_report(osv.osv):
'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),
'response_id': fields.many2one('survey.response', 'Response_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'),
@@ -66,7 +66,7 @@ class hr_evaluation_report(osv.osv):
date_trunc('day',s.create_date) as create_date,
to_char(s.create_date, 'YYYY-MM-DD') as day,
s.employee_id,
l.request_id,
l.response_id,
s.plan_id,
s.rating,
s.date as deadline,
@@ -91,7 +91,7 @@ class hr_evaluation_report(osv.osv):
s.employee_id,
s.date,
s.date_close,
l.request_id,
l.response_id,
s.rating,
s.plan_id
)
@@ -10,19 +10,7 @@
<record id="survey.menu_surveys" model="ir.ui.menu">
<field eval="[(4,ref('base.group_hr_manager'))]" name="groups_id"/>
</record>
<record id="survey.menu_define_survey" model="ir.ui.menu">
<field eval="[(4,ref('base.group_hr_manager'))]" name="groups_id"/>
</record>
<record id="survey.menu_survey_form" model="ir.ui.menu">
<field eval="[(4,ref('base.group_hr_manager'))]" name="groups_id"/>
</record>
<record id="survey.menu_survey_page_form1" model="ir.ui.menu">
<field eval="[(4,ref('base.group_hr_manager'))]" name="groups_id"/>
</record>
<record id="survey.menu_survey_type_form1" model="ir.ui.menu">
<field eval="[(4,ref('base.group_hr_manager'))]" name="groups_id"/>
</record>
<record id="survey.menu_answer_surveys" model="ir.ui.menu">
<record id="survey.menu_reporting" model="ir.ui.menu">
<field eval="[(4,ref('base.group_hr_manager'))]" name="groups_id"/>
</record>
@@ -8,29 +8,21 @@ access_hr_evaluation_interview_employee,hr.evaluation.interview.employee,model_h
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_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_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_base_calendar_attendee_survey_user,base.calendar.calendar.attendee.survey.user,base_calendar.model_calendar_attendee,base.group_survey_user,1,1,1,0
access_base_calendar_attendee_tool_user,base.calendar.calendar.attendee.tool.user,base_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_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
@@ -39,4 +31,3 @@ access_survey_response_hr_employee,survey.response.employee,survey.model_survey_
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
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
8 access_hr_evaluation_report hr.evaluation.report model_hr_evaluation_report base.group_hr_manager 1 1 1 1
9 access_survey_type_hr_manager survey.type survey.model_survey_type base.group_hr_manager 1 1 1 1
10 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
11 access_survey_question_hr_manager survey.question survey.model_survey_question base.group_hr_manager 1 1 1 1
12 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
13 access_survey_answer_hr_manager survey.answer survey.model_survey_answer base.group_hr_manager 1 1 1 1
14 access_survey_response_hr_manager survey.response survey.model_survey_response base.group_hr_manager 1 1 1 1
15 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
16 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
17 access_survey_answer_hr_user survey.answer.hr.user survey.model_survey_answer base.group_hr_user 1 1 1 0
18 access_survey_response_answer_hr_user survey.response.answer.hr.user survey.model_survey_response_answer base.group_hr_user 1 1 1 0
19 access_survey_type_hr_user survey.type.hr.user survey.model_survey_type base.group_hr_user 1 1 1 0
20 access_survey_question_hr_user survey.question.hr.user survey.model_survey_question base.group_hr_user 1 1 1 0
21 access_survey_page_hr_user survey.page.hr.user survey.model_survey_page base.group_hr_user 1 1 1 1
22 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
23 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
24 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
25 access_base_calendar_attendee_survey_user base.calendar.calendar.attendee.survey.user base_calendar.model_calendar_attendee base.group_survey_user 1 1 1 0
access_base_calendar_attendee_tool_user base.calendar.calendar.attendee.tool.user base_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
26 access_survey_hr_employee survey.hr.employee survey.model_survey base.group_user 1 1 0 0
27 access_survey_page_hr_employee survey.page.hr.employee survey.model_survey_page base.group_user 1 0 0 0
28 access_survey_answer_hr_employee survey.answer.employee survey.model_survey_answer base.group_user 1 0 0 0
31 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
32 access_survey_response_line_hr_employee survey.response.line.employee survey.model_survey_response_line base.group_user 1 1 1 0
33 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
@@ -33,23 +33,24 @@
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_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"
-
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',
interview_data = interview_obj.browse(cr, uid, interview_ids[0])
assert interview_data.response_id.state != 'new', 'Response should be in new state'
response_id = interview_data.response_id.id
ctx = {'survey_id': ref("survey_2"), 'response_id': response_id}
self.create(cr, uid, {'survey_id': ref("survey_2"),
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',
@@ -59,10 +60,10 @@
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_obj = self.pool.get('hr.evaluation.interview')
interview_obj.survey_req_done(cr, uid, [r.id for r in evaluation.interview_ids])
for survey in evaluation.interview_ids:
interview = interview_obj.browse(cr, uid, survey.id, context)
assert interview.state == "done", 'survey must be in done state'
-
@@ -70,7 +71,7 @@
-
!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])
self.pool.get('hr.evaluation.interview').action_print_survey(cr, uid, [r.id for r in evaluation.interview_ids])
-
I click on "Final Validation" button to finalise evaluation.
-
+2 -2
View File
@@ -205,7 +205,7 @@ class hr_applicant(osv.Model):
'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"),
'response_id': fields.many2one('survey.response', 'applicant_id'),
'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', \
@@ -313,7 +313,7 @@ class hr_applicant(osv.Model):
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, })
context.update({'survey_id': record.survey.id, 'response_id': [record.response_id], 'response_no': 0, })
value = self.pool.get("survey").action_print_survey(cr, uid, ids, context=context)
return value
@@ -80,10 +80,11 @@
<record id="survey_job_0" model="survey">
<field name="title">Job Survey</field>
<field name="max_response_limit">20</field>
<field eval="[(6,0,[])]" name="users"/>
<field name="type" ref="survey.survey_type1"/>
<field name="responsible_id" ref="base.user_root"/>
<field name="response_user">5</field>
<field name="max_response_limit">15</field>
<field name="state">open</field>
<field name="sign_in">1</field>
</record>
<record id="survey_page_job_0" model="survey.page">
<field name="title">Default Section</field>
@@ -54,7 +54,7 @@
<field name="date_action" invisible="context.get('invisible_next_date', True)"/>
<field name="source_id" invisible="1"/>
<field name="survey" invisible="1"/>
<field name="response" invisible="1"/>
<field name="response_id" invisible="1"/>
<field name="priority"/>
<field name="type_id" invisible="1"/>
<field name="availability" invisible="1"/>
@@ -78,7 +78,7 @@
string="Schedule Meeting" help="Schedule interview with this applicant"/>
<button name="%(survey.action_view_survey_question_message)d" type="action"
string="Start Interview" help="Answer related job question"
context="{'survey_id': survey, 'response_id': [response], 'response_no':0 ,'active' : response, 'object' : 'hr.applicant'}"
context="{'survey_id': survey, 'response_id': [response_id]}"
attrs="{'invisible':[('survey','=',False)]}"/>
<button name="action_print_survey" type="object"
string="Print Interview" help="Print interview report"
@@ -118,7 +118,7 @@
</group>
<group string="Job">
<field name="survey" invisible="1"/>
<field name="response" invisible="1"/>
<field name="response_id" invisible="1"/>
<field name="job_id" on_change="onchange_job(job_id)"/>
<field name="department_id" on_change="onchange_department_id(department_id, stage_id)"/>
<label for="availability"/>
@@ -52,7 +52,8 @@
-
!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")})
applicant = self.pool.get('hr.applicant').browse(cr, uid, ref("hr_case_programmer"), context=context)
ctx.update({'survey_id': ref("survey_job_0"), 'survey_token': applicant.job_id.survey_id.token})
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)
@@ -0,0 +1 @@
import portal_anonymous_survey
@@ -0,0 +1,18 @@
{
'name': 'Anonymous portal for Survey',
'version': '0.1',
'category': 'Tools',
'complexity': 'easy',
'description': """
This module adds authenticate options to survey and portal anonymous are installed.
===================================================================================
""",
'author': 'OpenERP SA',
'depends': ['survey','portal_anonymous'],
'data': [
'portal_anonymous_survey_view.xml',
],
'installable': True,
'auto_install': True,
'category': 'Hidden',
}
@@ -0,0 +1,33 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-TODAY OpenERP S.A. <http: //www.openerp.com>
#
# This program is free software: you can redistribute it and / or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http: //www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import fields, osv
class portal_anonymous_survey(osv.osv):
_inherit = "survey"
_defaults = {
'authenticate': False,
}
portal_anonymous_survey()
# vim: exp and tab: smartindent: tabstop=4: softtabstop=4: shiftwidth=4:
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="portal_anonymous_survey_view_form" model="ir.ui.view">
<field name="name">portal.anonymous.survey</field>
<field name="model">survey</field>
<field name="inherit_id" ref="survey.survey_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='authenticate']" position="replace">
<field name="authenticate"/>
</xpath>
</field>
</record>
</data>
</openerp>