"""
action_data = False
action_pool = self.pool.get('ir.actions.act_window')
- message_pool = self.browse(cr ,uid, ids, context=context)[0]
+ message_pool = self.browse(cr, uid, ids, context=context)[0]
att_ids = [x.id for x in message_pool.attachment_ids]
action_ids = action_pool.search(cr, uid, [('res_model', '=', 'ir.attachment')])
if action_ids:
text = decode_header(text.replace('\r', ''))
return ''.join([tools.ustr(x[0], x[1]) for x in text])
- def to_email(self,text):
- return re.findall(r'([^ ,<@]+@[^> ,]+)',text)
+ def to_email(self, text):
+ return re.findall(r'([^ ,<@]+@[^> ,]+)', text)
def parse_message(self, message):
"""Return Dictionary Object after parse EML Message String
msg['body'] = tools.ustr(body, encoding)
attachments = {}
- has_plain_text = False
if msg_txt.is_multipart() or 'multipart/alternative' in msg.get('content-type', ''):
body = ""
if 'multipart/alternative' in msg.get('content-type', ''):
import email
from email.utils import parsedate
-import base64
from tools.translate import _
import logging
model_pool = self.pool.get(model)
fields = model_pool.fields_get(cr, uid, context=context)
data = model_pool.default_get(cr, uid, fields, context=context)
- if 'name' in fields and not data.get('name',False):
+ if 'name' in fields and not data.get('name', False):
data['name'] = msg.get('from','')
res_id = model_pool.create(cr, uid, data, context=context)
if isinstance(ids, (str, int, long)):
ids = [long(ids)]
for thread in self.browse(cr, uid, ids, context=context):
- l=[]
+ l = []
for message in thread.message_ids:
l.append((message.user_id and message.user_id.email) or '')
l.append(message.email_from or '')
message_id = False
# Reply Email
- if context.get('mail',False) == 'reply' and mail.message_id:
+ if context.get('mail') == 'reply' and mail.message_id:
references = mail.references and mail.references + "," + mail.message_id or mail.message_id
else:
message_id = mail.message_id