콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
6712 화면

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,

   @api.cr_uid_id
    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))
            else:
                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))
            else:
                connection = POP3(server.server, int(server.port))
            #TODO: use this to remove only unread messages
            #connection.user("recent:"+server.user)
            connection.user(server.user)
            connection.pass_(server.password)
        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):
            try:
                connection = server.connect(server.id)
                server.write({'state':'done'})
            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))
            finally:
                try:
                    if connection:
                        if server.type == 'imap':
                            connection.close()
                        elif server.type == 'pop':
                            connection.quit()
                except Exception:
                    # ignored, just a consequence of the previous exception
                    pass
        return True

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

Hope this helps,

 

 

아바타
취소
관련 게시물 답글 화면 활동
0
3월 25
1414
0
1월 25
3493
0
11월 24
1597
1
8월 23
14847
change password 해결 완료
1
8월 23
13499