Reverting to old *non working* hr_evaluation, still not working with new survey

bzr revid: rim@openerp.com-20131021151220-fj6qi52la794m6ub
This commit is contained in:
Richard Mathot (OpenERP)
2013-10-21 17:12:20 +02:00
parent 3e5977db6a
commit e5ea84c6bd
5 changed files with 49 additions and 43 deletions
@@ -7,7 +7,7 @@
<field name="res_model">hr.evaluation.interview</field>
<field name="view_type">form</field>
<field name="view_id" eval="False"/>
<field name="domain">[('is_evaluation' ,'=', True), ('state','=','wait')]</field>
<field name="domain">[('is_evaluation' ,'=', True), ('user_id', '=', uid),('state','=','waiting_answer')]</field>
<field name="search_view_id" ref="view_hr_evaluation_interview_search"/>
</record>
+13 -13
View File
@@ -142,7 +142,7 @@ class hr_evaluation(osv.osv):
('3','Exceeds expectations'),
('4','Significantly exceeds expectations'),
], "Appreciation", help="This is the appreciation on which the evaluation is summarized."),
'survey_response_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'),
@@ -229,7 +229,7 @@ class hr_evaluation(osv.osv):
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_response_ids) != len(request_obj.search(cr, uid, [('evaluation_id', '=', evaluation.id),('state', 'in', ['done','cancel'])], 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."))
return True
@@ -240,7 +240,7 @@ class hr_evaluation(osv.osv):
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_response_ids])
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)
return True
@@ -254,7 +254,7 @@ class hr_evaluation(osv.osv):
if context is None:
context = {}
default = default.copy()
default['survey_response_ids'] = []
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):
@@ -266,13 +266,13 @@ 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_response_ids:
for survey_req in evalutation.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_response(osv.osv):
_inherit = "survey.response"
class survey_request(osv.osv):
_inherit = "survey.request"
_columns = {
'is_evaluation': fields.boolean('Is Appraisal?'),
}
@@ -280,12 +280,12 @@ class survey_response(osv.osv):
class hr_evaluation_interview(osv.osv):
_name = 'hr.evaluation.interview'
_inherits = {'survey.response': 'response_id'}
_inherits = {'survey.request': 'request_id'}
_inherit = 'mail.thread'
_rec_name = 'response_id'
_rec_name = 'request_id'
_description = 'Appraisal Interview'
_columns = {
'response_id': fields.many2one('survey.response','response_id', ondelete='cascade', required=True),
'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'),
}
@@ -299,12 +299,12 @@ class hr_evaluation_interview(osv.osv):
reads = self.browse(cr, uid, ids, context=context)
res = []
for record in reads:
name = record.response_id.survey_id.title
name = record.request_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': 'wait'}, context=context)
self.write(cr, uid, ids, { 'state': 'waiting_answer'}, context=context)
return True
def survey_req_done(self, cr, uid, ids, context=None):
@@ -314,7 +314,7 @@ class hr_evaluation_interview(osv.osv):
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_response_ids
records = hr_eval_obj.browse(cr, uid, [id.evaluation_id.id], context=context)[0].survey_request_ids
for child in records:
if child.state == "draft":
wating_id = child.id
+23 -23
View File
@@ -180,27 +180,27 @@
</group>
</group>
<group string="Appraisal Forms" attrs="{'invisible':[('state','=','draft')]}">
<field nolabel="1" name="survey_response_ids" attrs="{'readonly': [('state', '=', 'done')]}">
<field nolabel="1" name="survey_request_ids" attrs="{'readonly': [('state', '=', 'done')]}">
<form string="Interview Appraisal" version="7.0">
<div class="oe_right oe_button_box">
<button name="%(survey.action_view_survey_question_message)d" string="Answer Survey" type="action" states="open" icon="gtk-execute" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0, 'active' : response,'request' : True, 'object' : 'hr.evaluation.interview', 'cur_id' : active_id}" attrs="{'readonly':[('survey_id','=',False)]}"/>
<button name="%(survey.action_view_survey_question_message)d" string="Answer Survey" type="action" states="waiting_answer" icon="gtk-execute" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0, 'active' : response,'request' : True, 'object' : 'hr.evaluation.interview', 'cur_id' : active_id}" attrs="{'readonly':[('survey_id','=',False)]}"/>
<button name="%(survey.survey_browse_response)d" string="Print Interview" type="action" states="done" icon="gtk-print" context="{'survey_id': survey_id, 'response_id' : [response], 'response_no':0,}" attrs="{'readonly':[('response','=',False)]}" />
</div>
<group>
<group>
<field name="survey_id"/>
<field name="user_to_review_id"/>
<!-- <field name="user_id" string="Interviewer" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_hr_manager']}"/>-->
<field name="user_id" string="Interviewer" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_hr_manager']}"/>
</group>
<group>
<field name="date_deadline"/>
<field name="response_id" readonly="1"/>
<field name="response" readonly="1"/>
</group>
</group>
<group col="4" string="Status" invisible="1">
<field name="state"/>
<div>
<button string="Done" name="survey_req_done" states="open" type="object" icon="gtk-jump-to" />
<button string="Done" name="survey_req_done" states="waiting_answer" type="object" icon="gtk-jump-to" />
</div>
</group>
</form>
@@ -288,24 +288,24 @@
<form string="Interview Appraisal" version="7.0">
<header>
<button string="Cancel Survey" name="survey_req_cancel" type="object"
states="draft,open" class="oe_left"/>
states="draft,waiting_answer" class="oe_left"/>
<button string="Print Survey" name="action_print_survey" type="object"
states="draft" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0}"
attrs="{'readonly':[('survey_id','=',False)]}" class="oe_highlight"/>
<button string="Send Request" name="survey_req_open" type="object"
<button string="Send Request" name="survey_req_waiting_answer" type="object"
states="draft" class="oe_highlight"/>
<button string="Answer Survey" name="%(survey.action_view_survey_question_message)d" type="action"
states="open" class="oe_highlight"
states="waiting_answer" class="oe_highlight"
context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0, 'active' : response,'request' : True, 'object' : 'hr.evaluation.interview', 'cur_id' : active_id}"
attrs="{'readonly':[('survey_id','=',False)]}"/>
<button string="Done" name="survey_req_done" type="object"
states="open"/>
<field name="state" widget="statusbar" statusbar_visible="open,done"/>
states="waiting_answer"/>
<field name="state" widget="statusbar" statusbar_visible="waiting_answer,done"/>
</header>
<sheet>
<div class="oe_right oe_button_box" name="button_box">
<button string="Send Reminder Email" name="%(mail.action_email_compose_message_wizard)d" type="action"
states="open"
states="waiting_answer"
context="{'default_body_text': 'Hello,\n\nKindly post your response for the survey interview.\n\nThanks',
'default_subject': 'Reminder to fill up Survey' }"/>
</div>
@@ -313,11 +313,11 @@
<group>
<field name="survey_id"/>
<field name="user_to_review_id"/>
<!-- <field name="user_id" string="Interviewer" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_hr_manager']}"/>-->
<field name="user_id" string="Interviewer" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_hr_manager']}"/>
</group>
<group>
<field name="date_deadline"/>
- <field name="response_id" readonly="1"/>
<field name="response" readonly="1"/>
<field name="evaluation_id" string="Appraisal Plan"/>
</group>
</group>
@@ -333,15 +333,15 @@
<tree string="Interview Appraisal">
<field name="date_deadline" string="Deadline Date"/>
<field name="survey_id"/>
<!-- <field name="user_id" string="Interviewer"/> -->
<field name="user_id" string="Interviewer"/>
<field name="user_to_review_id"/>
<field name="response_id" readonly="1" invisible="True"/>
<button name="%(survey.action_view_survey_question_message)d" string="Answer Survey" type="action" states="open" icon="gtk-execute" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0, 'active' : response, 'request' : True, 'object' : 'hr.evaluation.interview', 'cur_id' : active_id}" attrs="{'readonly':[('survey_id','=',False)]}"/>
<field name="response" readonly="1" invisible="True"/>
<button name="%(survey.action_view_survey_question_message)d" string="Answer Survey" type="action" states="waiting_answer" icon="gtk-execute" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0, 'active' : response, 'request' : True, 'object' : 'hr.evaluation.interview', 'cur_id' : active_id}" attrs="{'readonly':[('survey_id','=',False)]}"/>
<button name="action_print_survey" string="Print Survey" type="object" icon="gtk-print" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0}" attrs="{'readonly':[('survey_id','=',False)]}"/>
<button name="%(mail.action_email_compose_message_wizard)d" string="Send Reminder Email" icon="terp-mail-message-new" type="action" states="open"/>
<button name="%(mail.action_email_compose_message_wizard)d" string="Send Reminder Email" icon="terp-mail-message-new" type="action" states="waiting_answer"/>
<field name="state"/>
<button string="Send Request" name="survey_req_open" states="draft" type="object" icon="gtk-yes" />
<button string="Done" name="survey_req_done" states="open" type="object" icon="gtk-jump-to" />
<button string="Send Request" name="survey_req_waiting_answer" states="draft" type="object" icon="gtk-yes" />
<button string="Done" name="survey_req_done" states="waiting_answer" type="object" icon="gtk-jump-to" />
</tree>
</field>
</record>
@@ -352,11 +352,11 @@
<field name="arch" type="xml">
<search string="Search Appraisal">
<field name="date_deadline"/>
<filter icon="terp-gtk-go-back-rtl" string="To Do" name="todo" domain="[('state','=','open')]"/>
<filter icon="terp-gtk-go-back-rtl" string="To Do" name="todo" domain="[('state','=','waiting_answer')]"/>
<field name="user_to_review_id"/>
<!-- <field name="user_id" string="Interviewer"/>-->
<field name="user_id" string="Interviewer"/>
<group expand="0" string="Group By...">
<!--<filter string="Interviewer" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>-->
<filter string="Interviewer" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="Survey" icon="terp-stock_align_left_24" domain="[]" context="{'group_by':'survey_id'}"/>
<filter string="Status" name="group_state" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
</group>
@@ -369,7 +369,7 @@
<field name="model">hr.evaluation.interview</field>
<field name="arch" type="xml">
<calendar string="Interview Request" color="user_to_review_id" date_start="date_deadline">
<field name="response_id"/>
<field name="request_id"/>
</calendar>
</field>
</record>
@@ -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),
'response_id': fields.many2one('survey.response', 'Response_id', readonly=True),
'request_id': fields.many2one('survey.request', 'Request_id', readonly=True),
'closed': fields.date("closed", readonly=True),
'year': fields.char('Year', size=4, readonly=True),
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
@@ -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.response_id,
l.request_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.response_id,
l.request_id,
s.rating,
s.plan_id
)
@@ -8,24 +8,29 @@ 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_response_hr_manager,survey.response,survey.model_survey_response,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_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_survey_response_hr_employee,survey.response.hr.employee,survey.model_survey_response,base.group_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
@@ -34,3 +39,4 @@ 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
11 access_survey_history_manager survey.history survey.model_survey_history base.group_hr_manager 1 1 1 1
12 access_survey_question_hr_manager survey.question survey.model_survey_question base.group_hr_manager 1 1 1 1
13 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
14 access_survey_answer_hr_manager survey.answer survey.model_survey_answer base.group_hr_manager 1 1 1 1
15 access_survey_response_hr_manager survey.response survey.model_survey_response base.group_hr_manager 1 1 1 1
16 access_survey_response_line_hr_manager survey.response.line survey.model_survey_response_line base.group_hr_manager 1 1 1 1
17 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
18 access_survey_response_answer_hr_manager survey.response.answer survey.model_survey_response_answer base.group_hr_manager 1 1 1 1
19 access_survey_response_hr_manager access_survey_request_hr_manager survey.response survey.request survey.model_survey_response survey.model_survey_request base.group_hr_manager 1 1 1 1
20 access_survey_answer_hr_user survey.answer.hr.user survey.model_survey_answer base.group_hr_user 1 1 1 0
21 access_survey_response_answer_hr_user survey.response.answer.hr.user survey.model_survey_response_answer base.group_hr_user 1 1 1 0
22 access_survey_type_hr_user survey.type.hr.user survey.model_survey_type base.group_hr_user 1 1 1 0
23 access_survey_question_hr_user survey.question.hr.user survey.model_survey_question base.group_hr_user 1 1 1 0
24 access_survey_page_hr_user survey.page.hr.user survey.model_survey_page base.group_hr_user 1 1 1 1
25 access_survey_response_hr_user survey.response.hr.user survey.model_survey_response base.group_hr_user 1 1 1 0
26 access_survey_response_hr_user access_survey_history_hr_user survey.response.hr.user survey.history.hr.user survey.model_survey_response survey.model_survey_history base.group_hr_user 1 1 1 0
27 access_survey_request_hr_user survey.request.hr.user survey.model_survey_request base.group_hr_user 1 1 1 0
28 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
29 access_survey_response_line_hr_user survey.response.line.hr.user survey.model_survey_response_line base.group_hr_user 1 1 1 0
30 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
31 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
32 access_survey_response_hr_employee access_base_calendar_attendee_tool_user survey.response.hr.employee base.calendar.calendar.attendee.tool.user survey.model_survey_response base_calendar.model_calendar_attendee base.group_user base.group_tool_user 1 1 1 0
33 access_survey_request_hr_employee survey.request.hr.employee survey.model_survey_request base.group_user 1 1 1 0
34 access_survey_hr_employee survey.hr.employee survey.model_survey base.group_user 1 1 0 0
35 access_survey_page_hr_employee survey.page.hr.employee survey.model_survey_page base.group_user 1 0 0 0
36 access_survey_answer_hr_employee survey.answer.employee survey.model_survey_answer base.group_user 1 0 0 0
39 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
40 access_survey_response_line_hr_employee survey.response.line.employee survey.model_survey_response_line base.group_user 1 1 1 0
41 access_survey_response_answer_hr_employee survey.response.answer.hr.employee survey.model_survey_response_answer base.group_user 1 1 1 0
42 access_survey_tbl_column_heading_hr_employee survey.tbl.column.heading survey.model_survey_tbl_column_heading base.group_user 1 1 1 0