Odoo Help

Welcome!

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.

0

JavaScript RPC with public user: Session expired

By
Christoph
on 6/18/15, 10:55 AM 945 views

I try to use RPC with JavaScript on a public website without a login. I tried this (just to test and show you what I did):

var session = new openerp.Session();
var suchmodel = new openerp.Model(session, 'such.model');
suchmodel .call('such.function', [suchvalue])
.then(function (result) {
console.log('then');
console.dir(result);
})
.fail(function (result) {
console.log('fail');
console.dir(result);
});


The fail function is called and the result.data.debug contains this error message:

Traceback (most recent call last):
File "/var/www/openerp/http.py", line 532, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/var/www/openerp/addons/base/ir/ir_http.py", line 151, in _dispatch
auth_method = self._authenticate(func.routing["auth"])
File "/var/www/openerp/addons/base/ir/ir_http.py", line 92, in _authenticate
getattr(self, "_auth_method_%s" % auth_method)()
File "/var/www/openerp/addons/base/ir/ir_http.py", line 69, in _auth_method_user
raise http.SessionExpiredException("Session expired")
SessionExpiredException: Session expired



I tried to use openerp.session but this is empty.


Is it possible to do this calls without a login?

0
Djordje Marjanovic
On 6/18/15, 3:06 PM

"Odoo requires users of the API to be authenticated before being able to query much data". Therefore, you must log in to use RPC calls.

<a href="https://www.odoo.com/documentation/8.0/api_integration.html">Web Service API</a>

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)

Stats

Asked: 6/18/15, 10:55 AM
Seen: 945 times
Last updated: 6/18/15, 3:06 PM