1 ##############################################################################
3 # OpenERP, Open Source Management Solution
4 # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU Affero General Public License as
8 # published by the Free Software Foundation, either version 3 of the
9 # License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU Affero General Public License for more details.
16 # You should have received a copy of the GNU Affero General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 ##############################################################################
21 from osv import fields, osv
24 class hr_evaluation_reminder(osv.osv_memory):
25 _name = "hr.evaluation.reminder"
26 _description = "Sends Reminders to employees to fill the evaluations"
28 'evaluation_id': fields.many2one('hr.evaluation.interview', 'Interview', required=True)
31 def send_mail(self, cr, uid, ids, context=None):
32 mail_message = self.pool.get('mail.message')
33 hr_evaluation_interview_obj = self.pool.get('hr.evaluation.interview')
34 evaluation_data = self.read(cr, uid, ids, context=context)[0]
35 current_interview = hr_evaluation_interview_obj.browse(cr, uid, evaluation_data.get('evaluation_id'))
36 if current_interview.state == "waiting_answer" and current_interview.user_to_review_id.work_email :
37 msg = " Hello %s, \n\n Kindly post your response for '%s' survey interview. \n\n Thanks," %(current_interview.user_to_review_id.name, current_interview.survey_id.title)
38 mail_message.schedule_with_attach(cr, uid, tools.config['email_from'], [current_interview.user_to_review_id.work_email],\
39 'Reminder to fill up Survey', msg, context=context)
40 return {'type': 'ir.actions.act_window_close'}
42 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: