[REVIEW+FIX] emails: fix

bzr revid: hmo@tinyerp.com-20110215062011-efn6o3vbj052jja4
This commit is contained in:
Harry (OpenERP) 2011-02-15 11:50:11 +05:30
parent b7baed1bca
commit 328024b462
3 changed files with 14 additions and 12 deletions

View File

@ -404,7 +404,7 @@ This is useful for CRM leads for example"),
if template.user_signature:
sign = self.pool.get('res.users').read(cr, uid, uid, ['signature'], context)['signature']
if values['description']:
values['description'] += sign
values['description'] += '\n\n' + sign
#if values['body_html']:
# values['body_html'] += sign

View File

@ -246,8 +246,7 @@ class email_message(osv.osv):
email_cc = [email_cc]
if email_bcc and type(email_bcc) != list:
email_bcc = [email_bcc]
if reply_to and type(reply_to) != list:
reply_to = [reply_to]
msg_vals = {
'name': subject,
'model': model or '',
@ -258,7 +257,7 @@ class email_message(osv.osv):
'email_to': email_to and ','.join(email_to) or '',
'email_cc': email_cc and ','.join(email_cc) or '',
'email_bcc': email_bcc and ','.join(email_bcc) or '',
'reply_to': reply_to and ','.join(reply_to) or '',
'reply_to': reply_to,
'res_id':openobject_id,
#'message_id': message_id,
'sub_type': subtype or '',
@ -287,6 +286,9 @@ class email_message(osv.osv):
{ 'attachment_ids': [[6, 0, attachment_ids]] }, context)
return email_msg_id
def process_retry(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'state':'waiting'}, context)
def process_email_queue(self, cr, uid, ids=None, context=None):
if ids is None:
ids = []
@ -315,17 +317,16 @@ class email_message(osv.osv):
message.name, message.description,
email_cc=message.email_cc and message.email_cc.split(',') or [],
email_bcc=message.email_bcc and message.email_bcc.split(',') or [],
reply_to=message.reply_to and message.reply_to.split(',') or [],
reply_to=message.reply_to,
attach=attachments, openobject_id=message.message_id,
subtype=message.sub_type,
x_headers=message.headers and eval(message.headers) or {},
priority=message.priority, debug=message.debug,
smtp_email_from=smtp_account and smtp_account.email_id or None,
smtp_server=smtp_account and smtp_account.smtpserver or None,
smtp_port=smtp_account and smtp_account.smtpport or None,
ssl=smtp_account and smtp_account.smtpssl or False,
smtp_user=smtp_account and smtp_account.smtpuname or None,
smtp_password=smtp_account and smtp_account.smtppass or None)
smtp_server=smtp_server and smtp_server.smtpserver or None,
smtp_port=smtp_server and smtp_server.smtpport or None,
ssl=smtp_server and smtp_server.smtpssl or False,
smtp_user=smtp_server and smtp_server.smtpuname or None,
smtp_password=smtp_server and smtp_server.smtppass or None)
if res:
self.write(cr, uid, [message.id], {'state':'sent'}, context)
else:

View File

@ -40,7 +40,8 @@
<field name="description" nolabel="1" colspan="4"/>
<separator string="" colspan="4"/>
<field name="state"/>
<button name="process_queue" string="Send" type="object" icon="gtk-execute" states='draft,waiting'/>
<button name="process_queue" string="Send" type="object" icon="gtk-execute" states='draft,waiting,sending'/>
<button name="process_retry" string="Re-Try" type="object" icon="gtk-execute" states='exception'/>
</page>
<page string="Attachments">
<separator string="Attachments" colspan="4"/>