This question has been flagged
5 Replies
6386 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'
Avatar
Discard

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

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

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

Best Answer

The problem persists, urgent help please

Avatar
Discard
Author Best Answer

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

Avatar
Discard