[IMP]: crm: Improvement in send new mail and add cc wizard
bzr revid: rpa@openerp.co.in-20100205072214-lvq3n3gwatau2pda
This commit is contained in:
parent
532ae3bcc7
commit
3392c4e4a1
|
@ -882,19 +882,22 @@ class crm_email_add_cc_wizard(osv.osv_memory):
|
|||
if not context:
|
||||
return {}
|
||||
history_line = self.pool.get('crm.case.history').browse(cr, uid, context['active_id'])
|
||||
crm_case = self.pool.get('crm.case')
|
||||
case = history_line.log_id.case_id
|
||||
model_obj = self.pool.get('ir.model')
|
||||
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,
|
||||
crm_case.format_body(body),
|
||||
model_pool.format_body(body),
|
||||
email_cc = [email],
|
||||
openobject_id=str(case.id)
|
||||
openobject_id=str(case.id),
|
||||
subtype="html"
|
||||
)
|
||||
if flag:
|
||||
crm_case.write(cr, uid, case.id, {'email_cc' : case.email_cc and case.email_cc +','+ email or email})
|
||||
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 {}
|
||||
|
|
|
@ -80,11 +80,9 @@ def _mass_mail_send(self, cr, uid, data, context):
|
|||
emails = [data['form']['to']] + (data['form']['cc'] or '').split(',')
|
||||
emails = filter(None, emails)
|
||||
body = data['form']['text']
|
||||
if not case.user_id.address_id.email:
|
||||
raise wizard.except_wizard(_('Warning!'),_("Please specify user's email address !"))
|
||||
if case.user_id.signature:
|
||||
body += '\n\n%s' % (case.user_id.signature)
|
||||
case_pool._history(cr, uid, [case], _('Send'), history=True, email=False, details=body)
|
||||
case_pool._history(cr, uid, [case], _('Send'), history=True, email=data['form']['to'], details=body)
|
||||
flag = tools.email_send(
|
||||
case.user_id.address_id.email,
|
||||
emails,
|
||||
|
@ -92,8 +90,8 @@ def _mass_mail_send(self, cr, uid, data, context):
|
|||
case_pool.format_body(body),
|
||||
attach=attach,
|
||||
reply_to=case.section_id.reply_to,
|
||||
|
||||
openobject_id=str(case.id)
|
||||
openobject_id=str(case.id),
|
||||
subtype="html"
|
||||
)
|
||||
if flag:
|
||||
if data['form']['state'] == 'unchanged':
|
||||
|
@ -113,9 +111,10 @@ def _get_info(self, cr, uid, data, context):
|
|||
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
case = pool.get(data.get('model')).browse(cr, uid, data['id'])
|
||||
|
||||
if not case.user_id:
|
||||
raise wizard.except_wizard(_('Error'),_('You must define a responsible user for this case in order to use this action!'))
|
||||
if not case.user_id.address_id.email:
|
||||
raise wizard.except_wizard(_('Warning!'),_("Please specify user's email address !"))
|
||||
|
||||
return {
|
||||
'to': case.email_from,
|
||||
|
|
Loading…
Reference in New Issue