Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

Email Error - KeyError: 'body' - Odoo 9

By
Gerald
on 12/7/15, 11:49 AM 1,201 views

Any help our guidance on email error would be most helpful.  Emails were working fine and then I started to get this error about KeyError: 'body'

Thanks in advance.

Gerald

Odoo Server Error

Traceback (most recent call last):
  File "/opt/odoo/odoo/openerp/http.py", line 599, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/opt/odoo/odoo/openerp/http.py", line 636, in dispatch
    result = self._call_function(**self.params)
  File "/opt/odoo/odoo/openerp/http.py", line 315, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/opt/odoo/odoo/openerp/service/model.py", line 118, in wrapper
    return f(dbname, *args, **kwargs)
  File "/opt/odoo/odoo/openerp/http.py", line 308, in checked_call
    result = self.endpoint(*a, **kw)
  File "/opt/odoo/odoo/openerp/http.py", line 887, in __call__
    return self.method(*args, **kw)
  File "/opt/odoo/odoo/openerp/http.py", line 465, in response_wrap
    response = f(*args, **kw)
  File "/opt/odoo/odoo/addons/web/controllers/main.py", line 975, in call_button
    action = self._call_kw(model, method, args, {})
  File "/opt/odoo/odoo/addons/web/controllers/main.py", line 963, in _call_kw
    return checked_call(request.db, *args, **kwargs)
  File "/opt/odoo/odoo/openerp/service/model.py", line 118, in wrapper
    return f(dbname, *args, **kwargs)
  File "/opt/odoo/odoo/addons/web/controllers/main.py", line 962, in checked_call
    return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
  File "/opt/odoo/odoo/openerp/api.py", line 238, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo/odoo/openerp/api.py", line 369, in old_api
    result = method(recs, *args, **kwargs)
  File "/opt/odoo/odoo/addons/mail/wizard/mail_compose_message.py", line 191, in send_mail_action
    return self.send_mail()
  File "/opt/odoo/odoo/openerp/api.py", line 236, in wrapper
    return new_api(self, *args, **kwargs)
  File "/opt/odoo/odoo/addons/purchase/purchase.py", line 928, in send_mail
    return super(MailComposeMessage, self.with_context(mail_post_autofollow=True)).send_mail(auto_commit=auto_commit)
  File "/opt/odoo/odoo/openerp/api.py", line 236, in wrapper
    return new_api(self, *args, **kwargs)
  File "/opt/odoo/odoo/addons/sale/sale.py", line 763, in send_mail
    return super(MailComposeMessage, self.with_context(mail_post_autofollow=True)).send_mail(auto_commit=auto_commit)
  File "/opt/odoo/odoo/openerp/api.py", line 236, in wrapper
    return new_api(self, *args, **kwargs)
  File "/opt/odoo/odoo/addons/account/models/account_invoice.py", line 1292, in send_mail
    return super(MailComposeMessage, self).send_mail(auto_commit=auto_commit)
  File "/opt/odoo/odoo/openerp/api.py", line 236, in wrapper
    return new_api(self, *args, **kwargs)
  File "/opt/odoo/odoo/addons/mail/wizard/mail_compose_message.py", line 246, in send_mail
    ActiveModel.browse(res_id).message_post(message_type='comment', subtype=subtype, **mail_values)
  File "/opt/odoo/odoo/openerp/api.py", line 236, in wrapper
    return new_api(self, *args, **kwargs)
  File "/opt/odoo/odoo/addons/mail/models/mail_thread.py", line 1667, in message_post
    new_message = MailMessage.create(values)
  File "/opt/odoo/odoo/openerp/api.py", line 236, in wrapper
    return new_api(self, *args, **kwargs)
  File "/opt/odoo/odoo/addons/mail/models/mail_message.py", line 792, in create
    user_signature=self.env.context.get('mail_notify_user_signature', True))
  File "/opt/odoo/odoo/openerp/api.py", line 236, in wrapper
    return new_api(self, *args, **kwargs)
  File "/opt/odoo/odoo/addons/mail/models/mail_message.py", line 854, in _notify
    partners._notify(self, force_send=force_send, user_signature=user_signature)
  File "/opt/odoo/odoo/openerp/api.py", line 236, in wrapper
    return new_api(self, *args, **kwargs)
  File "/opt/odoo/odoo/addons/mail/models/res_partner.py", line 126, in _notify
    ('notify_email', '!=', 'none')])._notify_by_email(message, force_send=force_send, user_signature=user_signature)
  File "/opt/odoo/odoo/openerp/api.py", line 236, in wrapper
    return new_api(self, *args, **kwargs)
  File "/opt/odoo/odoo/addons/mail/models/res_partner.py", line 177, in _notify_by_email
    new_emails, new_recipients_nbr = self._notify_send(not_values['body'], not_values['subject'], recipient_template_values['not_followers'], **base_mail_values)
KeyError: 'body'

Gerald
it means that your "not_values" dictionary don't have any key like 'body'.
You can try printing "not_values" before this line to check the data.
and better look for the line where you are adding 'body' to "not_values" and see whether its actually executing or not.
Hope this will guide you somewhat in your issue

Pawan
on 12/8/15, 8:59 AM

I have the same error message. I did not change the modules. Did you find the solution?

Robin Dierckx
on 9/1/16, 9:46 AM

Post bug here https://github.com/odoo/odoo/issues/new, official guys supports you.

Zahin
on 9/6/16, 8:45 AM
0
Gerald
On 12/12/15, 4:06 AM

Pawan

Thanks for direction.  I will try that.  I haven't modified the modules at all, so I will also try to figure out which module cost problems.  'body' is referenced a few lines before the 'body' that is causing the error.

Gerald

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 12/7/15, 11:49 AM
Seen: 1201 times
Last updated: 9/1/16, 9:45 AM