diff options
| author | Ajay Chauhan (OpenERP) <cha@tinyerp.com> | 2012-07-10 15:52:01 +0530 |
|---|---|---|
| committer | Ajay Chauhan (OpenERP) <cha@tinyerp.com> | 2012-07-10 15:52:01 +0530 |
| commit | 6dbd4e000dcb22d2ffcfeb7a9080eeffcbbcc7f8 (patch) | |
| tree | 5d1c3d763d9282312b22ca9e226515f20ce37d47 /addons/crm/wizard | |
| parent | 4e08b80952c7f50357f8f97b69495562631e9d55 (diff) | |
| parent | f25ad676a34670f4ba1ac14bf2d6babd8ccc88b5 (diff) | |
[MERGE] merge with parent branch
bzr revid: cha@tinyerp.com-20120710102201-h5mjjkoyprp70lf0
Diffstat (limited to 'addons/crm/wizard')
| -rw-r--r-- | addons/crm/wizard/__init__.py | 1 | ||||
| -rw-r--r-- | addons/crm/wizard/crm_phonecall_to_meeting.py | 67 | ||||
| -rw-r--r-- | addons/crm/wizard/mail_compose_message.py | 63 |
3 files changed, 16 insertions, 115 deletions
diff --git a/addons/crm/wizard/__init__.py b/addons/crm/wizard/__init__.py index 2fc39c51505..9d128492422 100644 --- a/addons/crm/wizard/__init__.py +++ b/addons/crm/wizard/__init__.py @@ -19,7 +19,6 @@ # ############################################################################## -import mail_compose_message import crm_add_note import crm_lead_to_partner diff --git a/addons/crm/wizard/crm_phonecall_to_meeting.py b/addons/crm/wizard/crm_phonecall_to_meeting.py index 9e902142c94..a01765220b8 100644 --- a/addons/crm/wizard/crm_phonecall_to_meeting.py +++ b/addons/crm/wizard/crm_phonecall_to_meeting.py @@ -41,58 +41,23 @@ class crm_phonecall2meeting(osv.osv_memory): return {'type':'ir.actions.act_window_close'} def action_make_meeting(self, cr, uid, ids, context=None): + """ This opens Meeting's calendar view to schedule meeting on current Phonecall + @return : Dictionary value for created Meeting view """ - This opens Meeting's calendar view to schedule meeting on current Phonecall - @param self: The object pointer - @param cr: the current row, from the database cursor, - @param uid: the current user’s ID for security checks, - @param ids: List of Phonecall to Meeting IDs - @param context: A standard dictionary for contextual values - - @return : Dictionary value for created Meeting view - """ - value = {} - record_id = context and context.get('active_id', False) or False - - if record_id: - phonecall_obj = self.pool.get('crm.phonecall') - data_obj = self.pool.get('ir.model.data') - - # Get meeting views - result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_meetings_filter') - res = data_obj.read(cr, uid, result, ['res_id']) - id1 = data_obj._get_id(cr, uid, 'crm', 'crm_case_calendar_view_meet') - id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_form_view_meet') - id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_tree_view_meet') - if id1: - id1 = data_obj.browse(cr, uid, id1, context=context).res_id - if id2: - id2 = data_obj.browse(cr, uid, id2, context=context).res_id - if id3: - id3 = data_obj.browse(cr, uid, id3, context=context).res_id - - phonecall = phonecall_obj.browse(cr, uid, record_id, context=context) - context = { - 'default_phonecall_id': phonecall.id, - 'default_partner_id': phonecall.partner_id and phonecall.partner_id.id or False, - 'default_email': phonecall.email_from , - 'default_name': phonecall.name - } - - value = { - 'name': _('Meetings'), - 'domain' : "[('user_id','=',%s)]" % (uid), - 'context': context, - 'view_type': 'form', - 'view_mode': 'calendar,form,tree', - 'res_model': 'crm.meeting', - 'view_id': False, - 'views': [(id1, 'calendar'), (id2, 'form'), (id3, 'tree')], - 'type': 'ir.actions.act_window', - 'search_view_id': res['res_id'] - } - - return value + res = {} + phonecall_id = context and context.get('active_id', False) or False + if phonecall_id: + phonecall = self.pool.get('crm.phonecall').browse(cr, uid, phonecall_id, context) + res = self.pool.get('ir.actions.act_window').for_xml_id(cr, uid, 'base_calendar', 'action_crm_meeting', context) + res['context'] = { + 'default_phonecall_id': phonecall.id, + 'default_partner_id': phonecall.partner_id and phonecall.partner_id.id or False, + 'default_user_id': uid, + 'default_email_from': phonecall.email_from, + 'default_state': 'open', + 'default_name': phonecall.name, + } + return res crm_phonecall2meeting() diff --git a/addons/crm/wizard/mail_compose_message.py b/addons/crm/wizard/mail_compose_message.py deleted file mode 100644 index b82c3083f3a..00000000000 --- a/addons/crm/wizard/mail_compose_message.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- 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 - -SUPPORTED_MODELS = ['crm.lead',] - -class mail_compose_message(osv.osv_memory): - _inherit = 'mail.compose.message' - - def get_value(self, cr, uid, model, res_id, context=None): - """Returns a defaults-like dict with initial values for the composition - wizard when sending an email related to the document record identified - by ``model`` and ``res_id``. - - Overrides the default implementation to provide more default field values - related to the corresponding CRM case. - - :param str model: model name of the document record this mail is related to. - :param int res_id: id of the document record this mail is related to. - :param dict context: several context values will modify the behavior - of the wizard, cfr. the class description. - """ - result = super(mail_compose_message, self).get_value(cr, uid, model, res_id, context=context) - if model in SUPPORTED_MODELS and res_id: - model_obj = self.pool.get(model) - data = model_obj.browse(cr, uid , res_id, context) - user = self.pool.get('res.users').browse(cr, uid, uid, context=context) - result.update({ - 'subject' : data.name or False, - 'email_to' : data.email_from or False, - 'email_from' : user.user_email or tools.config.get('email_from', False), - 'body_text' : '\n' + tools.ustr(user.signature or ''), - 'email_cc' : tools.ustr(data.email_cc or ''), - 'model': model, - 'res_id': res_id, - 'subtype': 'plain', - }) - if hasattr(data, 'section_id'): - result.update({'reply_to' : data.section_id and data.section_id.reply_to or False}) - return result - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
