diff --git a/addons/crm_helpdesk/__init__.py b/addons/crm_helpdesk/__init__.py index 5d270dbebf8..7dca88af720 100644 --- a/addons/crm_helpdesk/__init__.py +++ b/addons/crm_helpdesk/__init__.py @@ -21,6 +21,7 @@ import crm_helpdesk import report +import wizard # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/crm_helpdesk/crm_helpdesk.py b/addons/crm_helpdesk/crm_helpdesk.py index ff503a8fb3e..5fed445bfcb 100644 --- a/addons/crm_helpdesk/crm_helpdesk.py +++ b/addons/crm_helpdesk/crm_helpdesk.py @@ -26,7 +26,6 @@ from crm import wizard import binascii import tools -wizard.email_compose_message.email_model.append('crm.helpdesk') CRM_HELPDESK_STATES = ( crm.AVAILABLE_STATES[2][0], # Cancelled crm.AVAILABLE_STATES[3][0], # Done diff --git a/addons/crm_helpdesk/wizard/__init__.py b/addons/crm_helpdesk/wizard/__init__.py new file mode 100644 index 00000000000..6e9830a5f3a --- /dev/null +++ b/addons/crm_helpdesk/wizard/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# 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 email_compose_message + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/crm_helpdesk/wizard/email_compose_message.py b/addons/crm_helpdesk/wizard/email_compose_message.py new file mode 100644 index 00000000000..0b04ca0b31c --- /dev/null +++ b/addons/crm_helpdesk/wizard/email_compose_message.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2010-Today 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 +from osv import fields +import tools + +class email_compose_message(osv.osv_memory): + _inherit = 'email.compose.message' + + def get_value(self, cr, uid, model, resource_id, context=None): + if context is None: + context = {} + result = super(email_compose_message, self).get_value(cr, uid, model, resource_id, context=context) + if model == 'crm.helpdesk' and resource_id: + model_obj = self.pool.get(model) + data = model_obj.browse(cr, uid , resource_id, context) + result.update({ + 'subject' : data.name or False, + 'email_to' : data.email_from or False, + 'email_from' : data.user_id and data.user_id.address_id and data.user_id.address_id.email or False, + 'body' : '\n' + (tools.ustr(data.user_id.signature or '')), + 'email_cc' : tools.ustr(data.email_cc or ''), + 'model': model or False, + 'res_id': resource_id or False, + }) + return result + +email_compose_message() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/event/event.py b/addons/event/event.py index 5e757d02903..e4728677bca 100644 --- a/addons/event/event.py +++ b/addons/event/event.py @@ -27,7 +27,6 @@ from tools.translate import _ import decimal_precision as dp from crm import wizard -wizard.email_compose_message.email_model.append('event.registration') class event_type(osv.osv): """ Event Type """ diff --git a/addons/event/wizard/__init__.py b/addons/event/wizard/__init__.py index fbc44f417f4..2c04a0f5fcd 100644 --- a/addons/event/wizard/__init__.py +++ b/addons/event/wizard/__init__.py @@ -23,4 +23,5 @@ import event_make_invoice import event_confirm_registration import event_confirm import partner_event_registration +import email_compose_message # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/event/wizard/email_compose_message.py b/addons/event/wizard/email_compose_message.py new file mode 100644 index 00000000000..8d949255a3f --- /dev/null +++ b/addons/event/wizard/email_compose_message.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2010-Today 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 +from osv import fields +import tools + +class email_compose_message(osv.osv_memory): + _inherit = 'email.compose.message' + + def get_value(self, cr, uid, model, resource_id, context=None): + if context is None: + context = {} + result = super(email_compose_message, self).get_value(cr, uid, model, resource_id, context=context) + if model == 'event.registration' and resource_id: + model_obj = self.pool.get(model) + data = model_obj.browse(cr, uid , resource_id, context) + result.update({ + 'subject' : data.event_id.name or False, + 'email_to' : data.email_from or False, + 'email_from' : data.user_id and data.user_id.address_id and data.user_id.address_id.email or False, + 'body' : '\n' + (tools.ustr(data.user_id.signature or '')), + 'email_cc' : tools.ustr(data.email_cc or ''), + 'model': model or False, + 'res_id': resource_id or False, + }) + return result + +email_compose_message() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index 24b226f922e..03666878b11 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -31,8 +31,6 @@ import tools from tools.translate import _ from crm import wizard -wizard.email_compose_message.email_model.append('hr.applicant') - AVAILABLE_STATES = [ ('draft', 'New'), ('open', 'In Progress'), diff --git a/addons/hr_recruitment/wizard/__init__.py b/addons/hr_recruitment/wizard/__init__.py index acabd219857..607db0a93b4 100644 --- a/addons/hr_recruitment/wizard/__init__.py +++ b/addons/hr_recruitment/wizard/__init__.py @@ -23,6 +23,7 @@ import hr_recruitment_phonecall import hr_recruitment_create_partner_job import hr_recruitment_employee_hired +import email_compose_message # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr_recruitment/wizard/email_compose_message.py b/addons/hr_recruitment/wizard/email_compose_message.py new file mode 100644 index 00000000000..9320badb28b --- /dev/null +++ b/addons/hr_recruitment/wizard/email_compose_message.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2010-Today 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 +from osv import fields +import tools + + +class email_compose_message(osv.osv_memory): + _inherit = 'email.compose.message' + + def get_value(self, cr, uid, model, resource_id, context=None): + if context is None: + context = {} + result = super(email_compose_message, self).get_value(cr, uid, model, resource_id, context=context) + if model == 'hr.applicant' and resource_id: + model_obj = self.pool.get(model) + data = model_obj.browse(cr, uid , resource_id, context) + result.update({ + 'subject' : data.name or False, + 'email_to' : data.email_from or False, + 'email_from' : data.user_id and data.user_id.address_id and data.user_id.address_id.email or False, + 'body' : '\n' + (tools.ustr(data.user_id.signature or '')), + 'email_cc' : tools.ustr(data.email_cc or ''), + 'model': model or False, + 'res_id': resource_id or False, + }) + return result + +email_compose_message() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 11e76f142a1..1d30cfbd74b 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -28,8 +28,6 @@ import time import tools from crm import wizard -wizard.email_compose_message.email_model.append('project.issue') - class project_issue_version(osv.osv): _name = "project.issue.version" _order = "name desc" diff --git a/addons/project_issue/wizard/__init__.py b/addons/project_issue/wizard/__init__.py new file mode 100644 index 00000000000..51d4faa47d6 --- /dev/null +++ b/addons/project_issue/wizard/__init__.py @@ -0,0 +1,25 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). All Rights Reserved +# $Id$ +# +# 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 email_compose_message + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project_issue/wizard/email_compose_message.py b/addons/project_issue/wizard/email_compose_message.py new file mode 100644 index 00000000000..655f04ad72a --- /dev/null +++ b/addons/project_issue/wizard/email_compose_message.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2010-Today 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 +from osv import fields +import tools + +class email_compose_message(osv.osv_memory): + _inherit = 'email.compose.message' + + def get_value(self, cr, uid, model, resource_id, context=None): + if context is None: + context = {} + result = super(email_compose_message, self).get_value(cr, uid, model, resource_id, context=context) + if model == 'project.issue' and resource_id: + model_obj = self.pool.get(model) + data = model_obj.browse(cr, uid , resource_id, context) + result.update({ + 'subject' : data.name or False, + 'email_to' : data.email_from or False, + 'email_from' : data.user_id and data.user_id.address_id and data.user_id.address_id.email or False, + 'body' : '\n' + (tools.ustr(data.user_id.signature or '')), + 'email_cc' : tools.ustr(data.email_cc or ''), + 'model': model or False, + 'res_id': resource_id or False, + }) + return result + +email_compose_message() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project_planning/__init__.py b/addons/project_planning/__init__.py index 3cf91b8b9f7..e664a57cf92 100644 --- a/addons/project_planning/__init__.py +++ b/addons/project_planning/__init__.py @@ -21,5 +21,6 @@ import project_planning import report +import wizard # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project_planning/wizard/__init__.py b/addons/project_planning/wizard/__init__.py new file mode 100644 index 00000000000..f32421ada61 --- /dev/null +++ b/addons/project_planning/wizard/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# 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 email_compose_message + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project_planning/wizard/email_compose_message.py b/addons/project_planning/wizard/email_compose_message.py new file mode 100644 index 00000000000..ed7ffdd0eb9 --- /dev/null +++ b/addons/project_planning/wizard/email_compose_message.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2010-Today 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 +from osv import fields +import tools + +class email_compose_message(osv.osv_memory): + _inherit = 'email.compose.message' + + def get_value(self, cr, uid, model, resource_id, context=None): + if context is None: + context = {} + result = super(email_compose_message, self).get_value(cr, uid, model, resource_id, context=context) + if model == 'project.task' and resource_id: + model_obj = self.pool.get(model) + data = model_obj.browse(cr, uid , resource_id, context) + result.update({ + 'subject' : data.name or False, + 'email_to' : data.user_id.user_email or False, + 'email_from' : data.user_id and data.user_id.address_id and data.user_id.address_id.email or False, + 'body' : '\n' + (tools.ustr(data.user_id.signature or '')), + 'model': model or False, + 'res_id': resource_id or False, + }) + return result + +email_compose_message() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: