[IMP] integrate email.compose.message wizard with project_scrum module.
bzr revid: ysa@tinyerp.com-20110221115700-yiz0x5ypgu5v3rb1
This commit is contained in:
parent
368808a4bb
commit
99b8e78d0f
|
@ -24,14 +24,14 @@ from osv import fields
|
|||
import tools
|
||||
|
||||
class email_compose_message(osv.osv_memory):
|
||||
_name = 'email.compose.message'
|
||||
_inherit = 'email.compose.message'
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
model = ['crm.lead', 'crm.claim', 'crm.fundraising', 'crm.helpdesk', 'event.registration', 'hr.applicant', 'project.issue']
|
||||
result = super(email_compose_message, self).default_get(cr, uid, fields, context=context)
|
||||
if context.get('record_id',False) and context.get('model',False):
|
||||
if context.get('record_id',False) and context.get('model',False) and context.get('model') in model:
|
||||
model_obj = self.pool.get(context.get('model'))
|
||||
data = model_obj.browse(cr, uid ,context.get('record_id'), context)
|
||||
if 'name' in fields:
|
||||
|
|
|
@ -104,7 +104,7 @@
|
|||
<button
|
||||
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'model': 'crm.lead', 'project.issue' : True, 'message_id':active_id}"
|
||||
context="{'mail':'reply', 'model': 'project.issue', 'project.issue' : True, 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
</tree>
|
||||
<form string="History">
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
'wizard/project_scrum_backlog_create_task_view.xml',
|
||||
'wizard/project_scrum_backlog_merger_view.xml',
|
||||
'wizard/project_scrum_postpone_view.xml',
|
||||
"wizard/project_scrum_email_view.xml",
|
||||
# "wizard/project_scrum_email_view.xml",
|
||||
'project_scrum_view.xml',
|
||||
'wizard/project_scrum_backlog_sprint_view.xml',
|
||||
'process/project_scrum_process.xml',
|
||||
|
|
|
@ -394,7 +394,9 @@
|
|||
<field name="date"/>
|
||||
<field name="sprint_id" domain="[('state', '=', 'open')]"/>
|
||||
<field name="user_id"/>
|
||||
<button name="%(action_project_scrum_email)d" string="Send Email" type="action" icon="terp-mail-message-new" />
|
||||
<button name="%(emails.action_email_compose_message_wizard)d"
|
||||
string="Send Email" type="action" icon="terp-mail-message-new"
|
||||
context="{'mail':'new', 'model': 'project.scrum.meeting', 'record_id' : active_id}"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Scrum Meeting">
|
||||
|
|
|
@ -23,7 +23,8 @@ import project_scrum_backlog_create_task
|
|||
import project_scrum_backlog_sprint
|
||||
import project_scrum_backlog_merger
|
||||
import project_scrum_postpone
|
||||
import project_scrum_email
|
||||
#import project_scrum_email
|
||||
import email_compose_message
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
# -*- 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
|
||||
from tools.translate import _
|
||||
|
||||
class email_compose_message(osv.osv_memory):
|
||||
_inherit = 'email.compose.message'
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
result = super(email_compose_message, self).default_get(cr, uid, fields, context=context)
|
||||
|
||||
if context.get('record_id',False) and context.get('model',False) and context.get('model') == 'project.scrum.meeting':
|
||||
|
||||
meeting_pool = self.pool.get('project.scrum.meeting')
|
||||
user_pool = self.pool.get('res.users')
|
||||
meeting = meeting_pool.browse(cr, uid, context.get('record_id'), context=context)
|
||||
sprint = meeting.sprint_id
|
||||
|
||||
if 'email_from' in fields and sprint.scrum_master_id and sprint.scrum_master_id.user_email:
|
||||
user_data = user_pool.browse(cr, uid, uid, context=context)
|
||||
user_email = user_data.address_id and user_data.address_id.email or False
|
||||
result.update({'email_from': user_email})
|
||||
|
||||
if 'email_to' in fields and sprint.scrum_master_id and sprint.scrum_master_id.user_email:
|
||||
result.update({'email_to': sprint.scrum_master_id.user_email})
|
||||
|
||||
if sprint.product_owner_id and sprint.product_owner_id.user_email:
|
||||
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})
|
||||
|
||||
if 'name' in fields:
|
||||
subject = _("Scrum Meeting : %s") %(meeting.date)
|
||||
result.update({'name': subject})
|
||||
|
||||
if 'description' in fields:
|
||||
message = _("Hello , \nI am sending you Scrum Meeting : %s for the Sprint '%s' of Project '%s'") %(meeting.date, sprint.name, sprint.project_id.name)
|
||||
result.update({'description': message})
|
||||
|
||||
return result
|
||||
|
||||
email_compose_message()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
Loading…
Reference in New Issue