From c184f21599567db7cefe5664d68808f522e95d07 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Tue, 23 Mar 2010 17:14:55 +0530 Subject: [PATCH] [REF]: crm: Separated osv_memory wizard for add cc from crm.py into wizard folder bzr revid: rpa@tinyerp.com-20100323114455-hdla4728nv6cyx69 --- addons/crm/__terp__.py | 1 + addons/crm/crm.py | 74 -------------- addons/crm/crm_view.xml | 35 ------- addons/crm/wizard/__init__.py | 3 +- addons/crm/wizard/crm_email_add_cc.py | 106 ++++++++++++++++++++ addons/crm/wizard/crm_email_add_cc_view.xml | 52 ++++++++++ 6 files changed, 160 insertions(+), 111 deletions(-) create mode 100644 addons/crm/wizard/crm_email_add_cc.py create mode 100644 addons/crm/wizard/crm_email_add_cc_view.xml diff --git a/addons/crm/__terp__.py b/addons/crm/__terp__.py index 2dab4b27a88..90d2a63e09a 100644 --- a/addons/crm/__terp__.py +++ b/addons/crm/__terp__.py @@ -74,6 +74,7 @@ between mails and Open ERP.""", 'wizard/crm_partner_to_opportunity_view.xml', 'wizard/crm_send_email_view.xml', + 'wizard/crm_email_add_cc_view.xml', 'crm_wizard.xml', 'crm_view.xml', diff --git a/addons/crm/crm.py b/addons/crm/crm.py index 0d2654aa9aa..612a128b32b 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -894,80 +894,6 @@ class crm_case_history(osv.osv): crm_case_history() -class crm_email_add_cc_wizard(osv.osv_memory): - """ Email Add CC""" - - _name = "crm.email.add.cc" - _description = "Email Add CC" - - _columns = { - 'name': fields.selection([('user', 'User'), ('partner', 'Partner'),\ - ('email', 'Email Address')], 'Send to', required=True), - 'user_id': fields.many2one('res.users', "User"), - 'partner_id': fields.many2one('res.partner', "Partner"), - 'email': fields.char('Email', size=32), - 'subject': fields.char('Subject', size=32), - } - - def change_email(self, cr, uid, ids, user, partner): - - """ @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 Mail’s IDs - """ - - if (not partner and not user): - return {'value': {'email': False}} - email = False - if partner: - addr = self.pool.get('res.partner').address_get(cr, uid, [partner], ['contact']) - if addr: - email = self.pool.get('res.partner.address').read(cr, uid, addr['contact'] , ['email'])['email'] - elif user: - addr = self.pool.get('res.users').read(cr, uid, user, ['address_id'])['address_id'] - if addr: - email = self.pool.get('res.partner.address').read(cr, uid, addr[0] , ['email'])['email'] - return {'value': {'email': email}} - - - def add_cc(self, cr, uid, ids, context={}): - - """ @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 create menu’s IDs - @param context: A standard dictionary for contextual values - """ - - data = self.read(cr, uid, ids[0]) - email = data['email'] - subject = data['subject'] - - if not context: - return {} - history_line = self.pool.get('crm.case.history').browse(cr, uid, context['active_id']) - model = history_line.log_id.model_id.model - model_pool = self.pool.get(model) - case = model_pool.browse(cr, uid, history_line.log_id.res_id) - body = history_line.description.replace('\n', '\n> ') - flag = tools.email_send( - case.user_id.address_id.email, - [case.email_from], - subject or '[' + str(case.id) + '] ' + case.name, - model_pool.format_body(body), - email_cc = [email], - openobject_id = str(case.id), - subtype = "html" - ) - - if flag: - model_pool.write(cr, uid, case.id, {'email_cc' : case.email_cc and case.email_cc + ',' + email or email}) - else: - raise osv.except_osv(_('Email Fail!'), ("Lastest Email is not sent successfully")) - return {} - -crm_email_add_cc_wizard() class users(osv.osv): _inherit = 'res.users' diff --git a/addons/crm/crm_view.xml b/addons/crm/crm_view.xml index 16abc70f8b8..1112c63f072 100644 --- a/addons/crm/crm_view.xml +++ b/addons/crm/crm_view.xml @@ -194,41 +194,6 @@ - - - - Add CC - crm.email.add.cc - form - -
- - - - - - - -