From a48431b0bee10a7eeab706f4cd3deff4cb8708ef Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 3 Aug 2012 15:14:06 +0200 Subject: [PATCH] [FIX] project.issue: actually use the Reply-To address of the project when sending out messages bzr revid: odo@openerp.com-20120803131406-vh5migr9bb5ij29y --- addons/project_issue/__init__.py | 6 +-- addons/project_issue/wizard/__init__.py | 24 ++++++++++ .../wizard/mail_compose_message.py | 45 +++++++++++++++++++ 3 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 addons/project_issue/wizard/__init__.py create mode 100644 addons/project_issue/wizard/mail_compose_message.py diff --git a/addons/project_issue/__init__.py b/addons/project_issue/__init__.py index f519698a60c..2589025a1c8 100644 --- a/addons/project_issue/__init__.py +++ b/addons/project_issue/__init__.py @@ -1,9 +1,8 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). All Rights Reserved -# $Id$ +# OpenERP, Open Source Business Applications +# Copyright (c) 2004-2012 OpenERP S.A. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by @@ -22,5 +21,6 @@ import project_issue import report +import wizard # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project_issue/wizard/__init__.py b/addons/project_issue/wizard/__init__.py new file mode 100644 index 00000000000..1c0487dd469 --- /dev/null +++ b/addons/project_issue/wizard/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Business Applications +# Copyright (c) 2012 OpenERP S.A. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +import mail_compose_message + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project_issue/wizard/mail_compose_message.py b/addons/project_issue/wizard/mail_compose_message.py new file mode 100644 index 00000000000..a84d3ea2ea3 --- /dev/null +++ b/addons/project_issue/wizard/mail_compose_message.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2012 OpenERP SA () +# +# 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 +# +############################################################################## + +from osv import osv + +class mail_compose_message(osv.osv_memory): + _inherit = 'mail.compose.message' + + def get_value(self, cr, uid, model, resource_id, context=None): + result = super(mail_compose_message, self).get_value(cr, uid, model, resource_id, context=context) + if not result.get('reply_to') and model == 'project.issue' and resource_id: + issue = self.pool.get('project.issue').browse(cr, uid, resource_id, context=context) + if issue.project_id.reply_to: + result['reply_to'] = issue.project_id.reply_to + return result + + def get_message_data(self, cr, uid, message_id, context=None): + result = super(mail_compose_message, self).get_message_data(cr, uid, message_id, context=context) + if not result.get('reply_to') and message_id: + msg = self.pool.get('mail.message').browse(cr, uid, message_id, context) + if msg.model == 'project.issue': + issue = self.pool.get('project.issue').browse(cr, uid, msg.res_id, context) + if issue.project_id and issue.project_id.reply_to: + result['reply_to'] = issue.project_id.reply_to + return result + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: