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
-
-
-
-
-
-
-
-
- Add CC
- ir.actions.act_window
- crm.email.add.cc
- form
- form
- new
-
-
diff --git a/addons/crm/wizard/__init__.py b/addons/crm/wizard/__init__.py
index 7b4bb5704f6..927467dfb54 100644
--- a/addons/crm/wizard/__init__.py
+++ b/addons/crm/wizard/__init__.py
@@ -20,7 +20,7 @@
##############################################################################
import crm_send_email
-import wizard_history_event
+import crm_email_add_cc
import crm_lead_to_partner
import crm_lead_to_opportunity
@@ -34,6 +34,5 @@ import crm_phonecall_to_meeting
import crm_phonecall_to_opportunity
import crm_partner_to_opportunity
-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/crm/wizard/crm_email_add_cc.py b/addons/crm/wizard/crm_email_add_cc.py
new file mode 100644
index 00000000000..9af1b5eda5d
--- /dev/null
+++ b/addons/crm/wizard/crm_email_add_cc.py
@@ -0,0 +1,106 @@
+# -*- 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 .
+#
+##############################################################################
+
+from osv import osv, fields
+from tools.translate import _
+import tools
+
+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 on_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={}):
+ """
+ Adds CC value in case
+ @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> ')
+ if not case.email_from:
+ raise osv.except_osv(_('Warning!'), ('No email Address defined for this case..'))
+ if not email:
+ raise osv.except_osv(_('Warning!'), ('Please Specify email address..'))
+ 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()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/crm/wizard/crm_email_add_cc_view.xml b/addons/crm/wizard/crm_email_add_cc_view.xml
new file mode 100644
index 00000000000..45ae389ba72
--- /dev/null
+++ b/addons/crm/wizard/crm_email_add_cc_view.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+ Add CC
+ crm.email.add.cc
+ form
+
+
+
+
+
+
+
+
+ Add CC
+ ir.actions.act_window
+ crm.email.add.cc
+ form
+ form
+ new
+
+
+
+