Odoo Help


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.


Getting an error while "Test & Confirm" Incoming Mail Server in Odoo V8

Hiren Vora - CEO at Emipro Technologies Pvt. Ltd. India
on 7/10/14, 3:35 AM 2,744 views

Dear Odoo Programmers,

When you install Odoo V8 and try to confirm Incoming mail server (By cliciking "Test & Confirm" button, you will get following Error.

Connection test failed!

Here is what we got instead:
connect() takes at least 4 arguments (4 given).

Actully this is not Queation, but the this question is itself a solution. See solution as below,

Solution :

To solve this error, You need to put decorator @api.cr_uid_id exactly above connect method,

addons/fetchmail/fetchmail.py and in button_confirm_login method, you will find this problem.

For example,

    def connect(self, cr, uid, server_id, context=None):
        if isinstance(server_id, (list,tuple)):
            server_id = server_id[0]
        server = self.browse(cr, uid, server_id, context)
        if server.type == 'imap':
            if server.is_ssl:
                connection = IMAP4_SSL(server.server, int(server.port))
                connection = IMAP4(server.server, int(server.port))
            connection.login(server.user, server.password)
        elif server.type == 'pop':
            if server.is_ssl:
                connection = POP3_SSL(server.server, int(server.port))
                connection = POP3(server.server, int(server.port))
            #TODO: use this to remove only unread messages
        return connection

The reason is when you  passing "id" in any method with using New API, you need to use @api.cr_uid_id as decorator in your method. If you don't want to put that decorator then simply pass id in connect method. See Bold fonts on following method.

    def button_confirm_login(self, cr, uid, ids, context=None):
        if context is None:
            context = {}
        for server in self.browse(cr, uid, ids, context=context):
                connection = server.connect(server.id)
            except Exception, e:
                _logger.exception("Failed to connect to %s server %s.", server.type, server.name)
                raise osv.except_osv(_("Connection test failed!"), _("Here is what we got instead:\n %s.") % tools.ustr(e))
                    if connection:
                        if server.type == 'imap':
                        elif server.type == 'pop':
                except Exception:
                    # ignored, just a consequence of the previous exception
        return True

Hope Odoo will modify code soon and solve this problem. :)

Hope this helps,



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)


Asked: 7/10/14, 3:35 AM
Seen: 2744 times
Last updated: 3/16/15, 8:10 AM