Technical Mailing lijst archieven

technical@mail.odoo.com

Avatar

Re: API Log Issue

door
Flowmoco, Dominic Pain
- 22-07-2019 05:23:13

Hi, David,

If you're logging in via the rpc api, then it won't set the uid in the calling code. It'll return the uid to you (or not, if login fails), and then you use that in subsequent calls.


Here's how I do it:

https://gist.github.com/WeeDom/73e465d779a1e454cd6a8f85addb774b

hth

Dom

Flowmoco

On 20/07/2019 10:34, David Bigand SRCM wrote:

Hello,

I have a recent issue to connect to Odoo throught API using Php Ripcord. Regarding the error, it seems that the issue come from Odoo. It seems that the variable self.env.uid remain empty, but The first log message indicate however that the connexion were successul.


res_user.py line.

<pre> self.env.cr.execute('SELECT password, password_crypt FROM res_users WHERE id=%s AND active', (self.env.uid,))</pre>

Error log

2019-07-20 09:26:36,520 377 INFO SRCM_XXXX odoo.addons.base.res.res_users: Login successful for db:SRCM_XXXX XXXX  login:XXXXX@XXXXXX.fr from n/a
2019-07-20 09:26:36,520 377 INFO SRCM_XXXX werkzeug: 127.0.0.1 - - [20/Jul/2019 09:26:36] "POST /xmlrpc/2/common HTTP/1.0" 200 -
2019-07-20 09:26:36,577 377 ERROR SRCM_XXXX odoo.sql_db: bad query: b"SELECT password, password_crypt FROM res_users WHERE id='' AND active"
ERROR: invalid input syntax for integer: ""
LINE 1: ... password, password_crypt FROM res_users WHERE id='' AND act...
                                                             ^

2019-07-20 09:26:36,577 377 ERROR SRCM_XXXX odoo.http: invalid input syntax for integer: ""
LINE 1: ... password, password_crypt FROM res_users WHERE id='' AND act...
                                                             ^
Traceback (most recent call last):
  File "/home/intranet_srcm/odoo/odoo/http.py", line 118, in dispatch_rpc
    result = dispatch(method, params)
  File "/home/intranet_srcm/odoo/odoo/service/model.py", line 35, in dispatch
    security.check(db,uid,passwd)
  File "/home/intranet_srcm/odoo/odoo/service/security.py", line 13, in check
    return res_users.check(db, uid, passwd)
  File "/home/intranet_srcm/odoo/odoo/addons/base/res/res_users.py", line 525, in check
    self.check_credentials(passwd)
  File "/home/intranet_srcm/odoo/addons/auth_crypt/models/res_users.py", line 54, in check_credentials
    self.env.cr.execute('SELECT password, password_crypt FROM res_users WHERE id=%s AND active', (self.env.uid,))
  File "/home/intranet_srcm/odoo/odoo/sql_db.py", line 155, in wrapper
    return f(self, *args, **kwargs)
  File "/home/intranet_srcm/odoo/odoo/sql_db.py", line 232, in execute
    res = self._obj.execute(query, params)
psycopg2.DataError: invalid input syntax for integer: ""
LINE 1: ... password, password_crypt FROM res_users WHERE id='' AND act...

Previously, I had no issue to connect and retreive result.


Regards

David

_______________________________________________
Mailing-List: https://www.odoo.com/groups/technical-62
Post to: mailto:technical@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

Referentie