Skip to content

FetchmailServer.fetch_mail() got an unexpected keyword argument 'raise_exception' #3509

@ikus060

Description

@ikus060

Module

fetchmail_attach_from_folder

Version 18.0

Describe the bug

When fetch mail is running, an exception get raised in the logs.

2026-01-23 23:09:00,400 1 ERROR ikus_18 odoo.addons.base.models.ir_cron: Job 'Mail: Fetchmail Service' (6) server action #134 failed·
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/tools/safe_eval.py", line 397, in safe_eval
    return unsafe_eval(c, globals_dict, locals_dict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "ir.actions.server(134,)", line 1, in <module>
  File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/fetchmail.py", line 213, in _fetch_mails
    return self.search([('state', '=', 'done'), ('server_type', '!=', 'local')]).fetch_mail(raise_exception=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: FetchmailServer.fetch_mail() got an unexpected keyword argument 'raise_exception'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_cron.py", line 570, in _callback
    self.env['ir.actions.server'].browse(server_action_id).run()
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions.py", line 995, in run
    res = runner(run_self, eval_context=eval_context)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/odoo/addons/website/models/ir_actions_server.py", line 60, in _run_action_code_multi
    res = super(ServerAction, self)._run_action_code_multi(eval_context)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions.py", line 827, in _run_action_code_multi
    safe_eval(self.code.strip(), eval_context, mode="exec", nocopy=True, filename=str(self))  # nocopy allows to return 'action'
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/odoo/tools/safe_eval.py", line 411, in safe_eval
    raise ValueError('%r while evaluating\n%r' % (e, expr))
ValueError: TypeError("FetchmailServer.fetch_mail() got an unexpected keyword argument 'raise_exception'") while evaluating
'model._fetch_mails()'

Base on Odoo source code, raise_exception was added to the function signature.

https://github.com/odoo/odoo/blame/7e25a1f6614b2caaae03eaa0029baeb34495fc68/addons/mail/models/fetchmail.py#L215

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions