1 # -*- coding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.com>)
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.
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.
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/>
20 ##############################################################################
23 from osv import fields
24 from tools.translate import _
26 class mail_compose_message(osv.osv_memory):
27 _inherit = 'mail.compose.message'
29 def get_value(self, cr, uid, model, resource_id, context=None):
31 To get values of the resource_id for the model
33 @param resource_id: id of a record for which values to be read
35 @return: Returns a dictionary
39 result = super(mail_compose_message, self).get_value(cr, uid, model, resource_id, context=context)
40 if model == 'project.scrum.meeting' and resource_id:
41 meeting_pool = self.pool.get('project.scrum.meeting')
42 user_pool = self.pool.get('res.users')
43 meeting = meeting_pool.browse(cr, uid, resource_id, context=context)
45 sprint = meeting.sprint_id
46 user_data = user_pool.browse(cr, uid, uid, context=context)
47 result.update({'email_from': user_data.address_id and user_data.address_id.email or False})
49 if sprint.scrum_master_id and sprint.scrum_master_id.user_email:
50 result.update({'email_to': sprint.scrum_master_id.user_email})
51 if sprint.product_owner_id and sprint.product_owner_id.user_email:
52 result.update({'email_to': result.get('email_to',False) and result.get('email_to') + ',' + sprint.product_owner_id.user_email or sprint.product_owner_id.user_email})
54 subject = _("Scrum Meeting : %s") %(meeting.date)
55 message = _("Hello , \nI am sending you Scrum Meeting : %s for the Sprint '%s' of Project '%s'") %(meeting.date, sprint.name, sprint.project_id.name)
65 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: