[FORWARD] [FIX] Forward port of revision 6920 of 6.1 addons branch.

Revid: revid:odo@openerp.com-20120727150051-e1q0m92tyrazz82f
Purpose: some fixes and more robuts handling of incoming emails

bzr revid: tde@openerp.com-20140212160857-s889npk2q133xvy2
This commit is contained in:
Thibault Delavallée
2014-02-12 17:08:57 +01:00
parent e09f5cd264
commit bc0232cee6
+3 -2
View File
@@ -198,6 +198,7 @@ openerp_mailgate: "|/path/to/openerp-mailgate.py --host=localhost -u %(uid)d -p
result, data = imap_server.search(None, '(UNSEEN)')
for num in data[0].split():
result, data = imap_server.fetch(num, '(RFC822)')
imap_server.store(num, '-FLAGS', '\\Seen')
res_id = mail_thread.message_process(cr, uid, server.object_id.model,
data[0][1],
save_original=server.original,
@@ -205,8 +206,8 @@ openerp_mailgate: "|/path/to/openerp-mailgate.py --host=localhost -u %(uid)d -p
context=context)
if res_id and server.action_id:
action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id, 'active_ids':[res_id], 'active_model': context.get("thread_model", server.object_id.model)})
imap_server.store(num, '+FLAGS', '\\Seen')
cr.commit()
imap_server.store(num, '+FLAGS', '\\Seen')
cr.commit()
count += 1
_logger.info("fetched/processed %s email(s) on %s server %s", count, server.type, server.name)
except Exception: