Login error OERP v8.0

Bug #1348057 reported by Adrian
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OERPLib
Invalid
Undecided
Unassigned

Bug Description

I was trying to pass mi code from v6.1 to v8.0 and when i'm trying to connect to my OERP server login doesn't work.
oerp = oerplib.OERP(server=OERP_CONF['ip'],
                        database=OERP_CONF['dbname'],
                        protocol=OERP_CONF['protocol'],
                        port=OERP_CONF['port'])

The oerp object is succesfully returned and i checked using for example oerp.db.list() and it works, but when i do
oerp.login(user=OERP_CONF['username'], passwd=OERP_CONF['password']) not working as before when server was in v6.1

try:
        oerp = oerplib.OERP(server=OERP_CONF['ip'],
                        database=OERP_CONF['dbname'],
                        protocol=OERP_CONF['protocol'],
                        port=OERP_CONF['port'])
        user = oerp.login(user=OERP_CONF['username'], passwd=OERP_CONF['password'])
        return oerp
    except:
        return False

Always return False when i call this function for make the connect and i have another error from xmlrpclib that i didn't have before.

1 Traceback (most recent call last):
  File "/opt/openerp/src/8.0/odoo/openerp/service/wsgi_server.py", line 76, in xmlrpc_return
    response = xmlrpclib.dumps((result,), methodresponse=1, allow_none=False, encoding=None)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1085, in dumps
    data = m.dumps(params)
  File "/usr/lib/python2.7/xmlrpclib.py", line 632, in dumps
    dump(v, write)
  File "/usr/lib/python2.7/xmlrpclib.py", line 654, in __dump
    f(self, value, write)
  File "/usr/lib/python2.7/xmlrpclib.py", line 714, in dump_array
    dump(v, write)
  File "/usr/lib/python2.7/xmlrpclib.py", line 654, in __dump
    f(self, value, write)
  File "/usr/lib/python2.7/xmlrpclib.py", line 735, in dump_struct
    dump(v, write)
  File "/usr/lib/python2.7/xmlrpclib.py", line 654, in __dump
    f(self, value, write)
  File "/usr/lib/python2.7/xmlrpclib.py", line 658, in dump_nil
    raise TypeError, "cannot marshal None unless allow_none is enabled"
TypeError: cannot marshal None unless allow_none is enabled

Revision history for this message
Sébastien Alix (sebastien-alix) wrote :

Hi,

This is due to a bug in Odoo, some fields on the 'res.users' and 'res.partner' models return None instead of False.
I reported this bug and made a Pull Request to Odoo : https://github.com/odoo/odoo/pull/1284
Not merged yet, we have to wait (or patch Odoo ourself).

Another solution is to make a raw login:

>>> oerp = oerplib.OERP(...)
>>> oerp._uid = oerp.common.login('DB', 'LOGIN', 'PASSWD')
>>> oerp._password = 'PASSWD'
>>> oerp._context = oerp.execute('res.users', 'context_get')
>>> # Use 'oerp' as before

But you can expect the bug you mention as soon as you read a 'res.users' or 'res.partner' record (maybe others?), so I don't know if it suits your needs...

Regards,

Revision history for this message
Adrian (arleal-mlg) wrote :

Ok, thanks for the help.

Revision history for this message
Sébastien Alix (sebastien-alix) wrote :

Fix merged upstream: https://github.com/odoo/odoo/pull/1284
I close this bug.

Changed in oerplib:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.