2011-02-22 11:45:15 +00:00
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
##############################################################################
from osv import osv
from osv import fields
import tools
from tools . translate import _
2011-08-22 17:16:59 +00:00
class mail_compose_message ( osv . osv_memory ) :
_inherit = ' mail.compose.message '
2011-02-22 11:45:15 +00:00
2011-03-01 07:40:05 +00:00
def get_value ( self , cr , uid , model , resource_id , context = None ) :
2011-04-19 11:58:50 +00:00
'''
To get values of the resource_id for the model
@param model : Object
@param resource_id : id of a record for which values to be read
@return : Returns a dictionary
'''
2011-02-22 11:45:15 +00:00
if context is None :
context = { }
2011-08-22 17:16:59 +00:00
result = super ( mail_compose_message , self ) . get_value ( cr , uid , model , resource_id , context = context )
2011-02-22 11:45:15 +00:00
if model == ' hr.evaluation.interview ' and resource_id :
model_pool = self . pool . get ( model )
record_data = model_pool . browse ( cr , uid , resource_id , context )
if record_data . state == " waiting_answer " :
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 )
2011-03-01 07:40:05 +00:00
result . update ( {
2011-03-01 09:50:57 +00:00
' email_to ' : record_data . user_to_review_id . work_email or False ,
2011-04-07 12:50:24 +00:00
' subject ' : _ ( " Reminder to fill up Survey " ) ,
2012-08-17 12:06:06 +00:00
' body ' : msg ,
2011-03-01 09:50:57 +00:00
} )
2011-02-22 11:45:15 +00:00
return result
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: