summaryrefslogtreecommitdiff
path: root/addons/fetchmail/fetchmail.py
diff options
context:
space:
mode:
authorSanjay Gohel (Open ERP) <sgo@tinyerp.com>2012-08-08 10:50:23 +0530
committerSanjay Gohel (Open ERP) <sgo@tinyerp.com>2012-08-08 10:50:23 +0530
commit0e77a7cbda6ea1e7500c42b84f741c5ecbd48a4e (patch)
treeb53aa7bf34f0c84b3bde7ba7b5bbad9d710a9bd2 /addons/fetchmail/fetchmail.py
parent1da7ac2448a5e29bb43994286d3fbb8d90576d54 (diff)
parentd58b36a8a36dcda196c3ed6d5b7421102ee33547 (diff)
[MERGE]merge with trunk addons
bzr revid: sgo@tinyerp.com-20120808052023-i87gopbxesqwfm0q
Diffstat (limited to 'addons/fetchmail/fetchmail.py')
-rw-r--r--addons/fetchmail/fetchmail.py27
1 files changed, 17 insertions, 10 deletions
diff --git a/addons/fetchmail/fetchmail.py b/addons/fetchmail/fetchmail.py
index 55923c3043a..f0e6a5179b4 100644
--- a/addons/fetchmail/fetchmail.py
+++ b/addons/fetchmail/fetchmail.py
@@ -71,7 +71,7 @@ class fetchmail_server(osv.osv):
'password' : fields.char('Password', size=1024, readonly=True, states={'draft':[('readonly', False)]}),
'action_id':fields.many2one('ir.actions.server', 'Server Action', help="Optional custom server action to trigger for each incoming mail, "
"on the record that was created or updated by this mail"),
- 'object_id': fields.many2one('ir.model', "Create a New Record", required=True, help="Process each incoming mail as part of a conversation "
+ 'object_id': fields.many2one('ir.model', "Create a New Record", help="Process each incoming mail as part of a conversation "
"corresponding to this document type. This will create "
"new documents for new conversations, or attach follow-up "
"emails to the existing conversations (documents)."),
@@ -189,10 +189,14 @@ openerp_mailgate.py -u %(uid)d -p PASSWORD -o %(model)s -d %(dbname)s --host=HOS
result, data = imap_server.search(None, '(UNSEEN)')
for num in data[0].split():
result, data = imap_server.fetch(num, '(RFC822)')
- res_id = mail_thread.message_process(cr, uid, server.object_id.model, data[0][1],
- save_original=server.original,
- strip_attachments=(not server.attach),
- context=context)
+ if server.object_id:
+ res_id = mail_thread.message_process(cr, uid, server.object_id.model,
+ data[0][1],
+ save_original=server.original,
+ strip_attachments=(not server.attach),
+ context=context)
+ else:
+ res_id = mail_thread.message_catchall(cr, uid, data[0][1])
if res_id and server.action_id:
action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id, 'active_ids':[res_id]})
imap_server.store(num, '+FLAGS', '\\Seen')
@@ -213,11 +217,14 @@ openerp_mailgate.py -u %(uid)d -p PASSWORD -o %(model)s -d %(dbname)s --host=HOS
for num in range(1, numMsgs + 1):
(header, msges, octets) = pop_server.retr(num)
msg = '\n'.join(msges)
- res_id = mail_thread.message_process(cr, uid, server.object_id.model,
- msg,
- save_original=server.original,
- strip_attachments=(not server.attach),
- context=context)
+ if server.object_id:
+ res_id = mail_thread.message_process(cr, uid, server.object_id.model,
+ msg,
+ save_original=server.original,
+ strip_attachments=(not server.attach),
+ context=context)
+ else:
+ res_id = mail_thread.message_catchall(cr, uid, data[0][1])
if res_id and server.action_id:
action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id, 'active_ids':[res_id]})
pop_server.dele(num)