[FIX] account_voucher: fixed onchange_payment_rate_currency
[odoo/odoo.git] / addons / hr_evaluation / wizard / mail_compose_message.py
1 # -*- coding: utf-8 -*-
2 ##############################################################################
3 #
4 #    OpenERP, Open Source Management Solution
5 #    Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.com>)
6 #
7 #    This program is free software: you can redistribute it and/or modify
8 #    it under the terms of the GNU General Public License as published by
9 #    the Free Software Foundation, either version 3 of the License, or
10 #    (at your option) any later version.
11 #
12 #    This program is distributed in the hope that it will be useful,
13 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 #    GNU General Public License for more details.
16 #
17 #    You should have received a copy of the GNU General Public License
18 #    along with this program.  If not, see <http://www.gnu.org/licenses/>
19 #
20 ##############################################################################
21
22 from osv import osv
23 from osv import fields
24 import tools
25 from tools.translate import _
26
27 class mail_compose_message(osv.osv_memory):
28     _inherit = 'mail.compose.message'
29
30     def get_value(self, cr, uid, model, resource_id, context=None):
31         '''
32         To get values of the resource_id for the model
33         @param model: Object
34         @param resource_id: id of a record for which values to be read
35
36         @return: Returns a dictionary
37         '''
38         if context is None:
39             context = {}
40         result = super(mail_compose_message, self).get_value(cr, uid,  model, resource_id, context=context)
41         if model == 'hr.evaluation.interview' and resource_id:
42             model_pool = self.pool.get(model)
43             record_data = model_pool.browse(cr, uid, resource_id, context)
44             if record_data.state == "waiting_answer":
45                 msg = _("Hello %s, \n\n Kindly post your response for '%s' survey interview. \n\n Thanks,")  %(record_data.user_to_review_id.name, record_data.survey_id.title)
46                 result.update({
47                         'email_from': tools.config.get('email_from',''),
48                         'email_to': record_data.user_to_review_id.work_email or False,
49                         'subject': _("Reminder to fill up Survey"),
50                         'body_text': msg,
51                         'res_id': resource_id,
52                         'model': model,
53                         'email_cc': False,
54                         'email_bcc': False,
55                         'reply_to': False,
56                     })
57         return result
58
59
60 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: