This question has been flagged
9 Replies
16614 Views

I wish to send emails to odoo to change data in specified records of an existing model in the system. Is there any documentation on this subject or a clear example that shows how to process a general purpose emal? As I wish to run on odoo-on-saas I cannot write a custom module but would be obliged to process the incoming email and update my data purely via server actions.

There are one or two posts on this system but these are out of date (the crm.lead description field is no longer written by the incoming email for example). Also there is no clear indication of whether a new record MUST be created - I have tried leaving this field blank and setting it to create a record of type message and neither seems to work.

Avatar
Discard
Best Answer

Hi,

Did you by any chance find a way to process incoming email since 2013?


Avatar
Discard
Best Answer

Hi Kurt,

Did you ever find a working example on how to propagate fields in the body of an incoming emal to certain records of an Odoo model? Even two years later I can only find the examples you allready mentioned, which are no longer relevant for current versions of Odoo. 

Thanks in advance!

Avatar
Discard
Best Answer

Create an imap catchall-account for your domain and configure incomming mail for this account (settings -> General Settings). Odoo will create mail-aliases for most of you objects (settings -> Email -> Alias), you can also add you own aliases.

You can also add more incomming mail accounts and administer "Actions to Perform on Incoming Mails".

 

 

Avatar
Discard
Author

Anders thanks for the comment but this does not explain how to extract and act upon data extracted from the body of the email. This requires a server action - the previous posts that touch on this subject are clearly out of date now.

You can add server actions in python-code for example: if context.get('active_model') == 'crm.lead' and context.get('active_ids'): self.case_mark_lost(cr, uid, context['active_ids'], context=context)

Author

A worked example would help me and many other people I think. The existing semi-examples posted on odoo help have typos and also no longer work. 1 Its not clear whether a database record always needs to be created - eg if we just want to update, say a status field in a delivery order we don't need a new lead or delivery order to be created. 2 If we are not creating a record in one of the models how do we access the fields (subject, body etc) from the incoming email message. I tried creating message records but this does not seem to work (on saas5). If this can be demonstrated then it provides a useful mechanism for synchronisation with other online systems.

Best Answer

Very interesting question.

But, how to parse the email content ?

Related question: https://www.odoo.com/forum/help-1/question/customize-the-auto-lead-creation-through-incoming-emails-272

                              http://stackoverflow.com/questions/17838142/using-python-to-parse-email-for-action-server

Some links:

                            https://zapier.com/zapbook/email-parser/openerp/

                            https://docs.python.org/2/library/email.parser.html

Can you tell me what you think about : https://github.com/Smile-SA/odoo_addons/tree/7.0/smile_action_trigger

                           

Avatar
Discard
Author

The first ref 1) is the classic one on this forum - this didn't work because of the typos shown in 2. 2) no longer works because the email body is no longer put into the crm.lead description field when the email is received (this change was uploaded to github around feb 2013) 3) is a zapier reference. I assume that this requires a custom module in odoo and so is therefore incompatible with odoo-on-saas I have not come across 5) before - but it too looks like it would require a custom module to be installed in odoo - again making it incompatible with odoo-on-saas. I am sure that this must be possible with odoo server actions - it is just knowing how to get access to the email body content. After that we can parse that content and do pretty much whatever we would like with server actions.

I think the email can be accessed via mail.mesagge model. The problem is how to trigger the server actions object?