[ADD] hr_evaluation: added wizard for functionality of reminders,improved code

bzr revid: kum@tinyerp.co.in-20100318083932-39sxx7v00dkwjxh0
This commit is contained in:
kum (Open ERP)
2010-03-18 14:09:32 +05:30
parent 18e4093880
commit 864e20fcd4
8 changed files with 124 additions and 10 deletions
+2 -1
View File
@@ -102,7 +102,8 @@ class hr_employee(osv.osv):
'address_id': fields.many2one('res.partner.address', 'Working Address'),
'address_home_id': fields.many2one('res.partner.address', 'Home Address'),
'work_phone': fields.related('address_id', 'phone', type='char', string='Work Phone'),
'work_email': fields.related('address_id', 'email', type='char', size=240, string='Work E-mail'),
'work_email': fields.char('Work E-mail', size=240),
# 'work_email': fields.related('address_id', 'email', type='char', size=240, string='Work E-mail'),
'work_location': fields.char('Office Location', size=32),
'notes': fields.text('Notes'),
+1
View File
@@ -20,6 +20,7 @@
##############################################################################
import hr_evaluation
import wizard
import report
+2 -1
View File
@@ -38,8 +38,9 @@
"demo_xml" : ["hr_evaluation_demo.xml"],
"update_xml" : [
"security/ir.model.access.csv",
"wizard/hr_evaluation_mail_view.xml",
"hr_evaluation_view.xml",
"hr_evaluation_data.xml",
"hr_evaluation_demo.xml",
"report/hr_evaluation_report_view.xml"],
"active": False,
"installable": True
+8 -6
View File
@@ -209,7 +209,7 @@ class hr_evaluation(osv.osv):
val = {
'employee_name':child.name,
'user_signature':curr_employee.name,
'company_name':user_obj_id.company_id.name,
# 'company_name':user_obj_id.company_id.name,
'eval_name':phase.survey_id.title,
'date':time.strftime('%Y-%m-%d'),
}
@@ -233,7 +233,7 @@ class hr_evaluation(osv.osv):
val.update({'employee_name':manager_employee.name})
mailbody = hr_eval_plan_obj.read(cr,uid,phase.id,['mail_body'],context=context)
body = mailbody['mail_body']%val
dest = [child.work_email]
dest = [manager_employee.work_email]
if dest:
tools.email_send(src,dest,sub,body)
apprai_id.append(id)
@@ -300,9 +300,10 @@ class hr_evaluation_interview(osv.osv):
def survey_req_waiting_answer(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, { 'state' : 'waiting_answer'})
# for id in self.browse(cr, uid, ids):
# if id.user_id and id.user_id.address_id and id.user_id.address_id and id.user_id.address_id.email:
# msg = " Hello %s, \n\n We are inviting you for %s survey. \n\n Thanks," %(id.user_id.name, id.survey_id.title)
# tools.email_send(tools.config['email_from'], [id.user_id.address_id.email],\
# print"id",id
# if id.user_to_review_id and id.user_to_review_id.work_email:
# msg = " Hello %s, \n\n We are inviting you for %s survey. \n\n Thanks," %(id.user_to_review_id.name, id.survey_id.title)
# tools.email_send(tools.config['email_from'], [id.user_to_review_id.work_email],\
# 'Invite to fill up Survey', msg)
return True
@@ -335,4 +336,5 @@ class hr_evaluation_interview(osv.osv):
self.write(cr, uid, ids, { 'state' : 'cancel'}, context=context)
return True
hr_evaluation_interview()
hr_evaluation_interview()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:1
+12 -2
View File
@@ -44,7 +44,7 @@
</record>
<menuitem name="Evaluations" parent="hr.menu_hr_root" id="menu_eval_hr" sequence="3"/>
<menuitem
<menuitem
name="Periodic Evaluations" parent="hr.menu_hr_configuration" id="menu_eval_hr_config" sequence="3"/>
<menuitem
parent="menu_eval_hr_config"
@@ -88,11 +88,17 @@
</group>
</page>
<page string="Mail Settings">
<field name="mail_feature"/>
<field name="mail_feature" colspan="4"/>
<newline/>
<separator string="Mail Body"/>
<newline/>
<field name="mail_body" colspan="4" nolabel="1"/>
<newline/>
<separator string="Legend" colspan ="4"/>
<label string=" (employee_name)s: Partner name" colspan="2"/>
<label string="(user_signature)s: User name" colspan="2"/>
<label string="(date)s: Current Date" colspan="2"/>
<label string="(eval_name)s:Evaluation Name" colspan="2"/>
</page>
</notebook>
</form>
@@ -320,5 +326,9 @@
id="menu_open_hr_evaluation_interview_requests"
action="action_hr_evaluation_interview_tree"/>
<menuitem name="Evaluation Reminders" parent="menu_eval_hr"
id="menu_eval_send_mail"
action="action_hr_evaluation_send_mail"
sequence="45"/>
</data>
</openerp>
+25
View File
@@ -0,0 +1,25 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# 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/>.
#
##############################################################################
import hr_evaluation_mail
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,43 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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 osv import fields, osv
import tools
class hr_evaluation_reminder(osv.osv_memory):
_name = "hr.evaluation.reminder"
_description = "Sends Reminders to employess to fill the evaluations"
_columns = {
'evaluation_id': fields.many2one('hr_evaluation.evaluation', 'Evaluations', required=True)
}
def send_mail(self, cr, uid, ids, context={}):
hr_evaluation_obj = self.pool.get('hr_evaluation.evaluation')
evaluation_data = self.read(cr, uid, ids, context=context)[0]
for waiting_id in hr_evaluation_obj.browse(cr, uid, evaluation_data['evaluation_id'], context=context).survey_request_ids:
if waiting_id.state == "waiting_answer" and waiting_id.user_to_review_id.work_email :
msg = " Hello %s, \n\n Kindly post your response for %s survey. \n\n Thanks," %(waiting_id.user_to_review_id.name, waiting_id.survey_id.title)
tools.email_send(tools.config['email_from'], [waiting_id.user_to_review_id.work_email],\
'Reminder to fill up Survey', msg)
return {'type': 'ir.actions.act_window_close'}
hr_evaluation_reminder()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_hr_evaluation_send_mail" model="ir.ui.view">
<field name="name">hr.evaluation.send.mail</field>
<field name="model">hr.evaluation.reminder</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Evaluation Reminders">
<field name="evaluation_id"/>
<newline/>
<button special="cancel" string="Cancel" />
<button name="send_mail" string="Send Mail" type="object"/>
</form>
</field>
</record>
<record id="action_hr_evaluation_send_mail" model="ir.actions.act_window">
<field name="name">Evaluation Send Mail</field>
<field name="res_model">hr.evaluation.reminder</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_hr_evaluation_send_mail"/>
<field name="context">{'record_id':active_id}</field>
<field name="target">new</field>
</record>
</data>
</openerp>