diff --git a/fetchmail_attach_from_folder/models/fetchmail_server.py b/fetchmail_attach_from_folder/models/fetchmail_server.py index 7d344395ab4..5c973e4827e 100644 --- a/fetchmail_attach_from_folder/models/fetchmail_server.py +++ b/fetchmail_attach_from_folder/models/fetchmail_server.py @@ -4,6 +4,7 @@ import re from odoo import _, api, fields, models +from odoo.exceptions import UserError _logger = logging.getLogger(__name__) @@ -30,7 +31,11 @@ def parse_list_response(line): if this.state != "done": this.folders_available = _("Confirm connection first.") continue - connection = this.connect() + try: + connection = this.connect() + except UserError: + this.folders_available = _("Confirm connection first.") + continue list_result = connection.list() if list_result[0] != "OK": this.folders_available = _("Unable to retrieve folders.")