تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
18475 أدوات العرض

Hello,

I would like to use the JSON-RPC protocol to load OpenERP datas. I can request a session ID and authenticate with correct parameters.

But when I try to load companies by using the model res.company I receive an exception.

My request :

{"jsonrpc":"2.0","method":"call","params":{"model":"res.company","fields":["currency_id","email","website","company_registry","vat","name","phone","partner_id"],"domain":[["id","=",1]],"context":{"lang":"fr_FR","tz":"Europe/Brussels","uid":1},"offset":0,"limit":false,"sort":"","session_id":"bf3f8e7849f14014a3bd6e24eece548e"},"id":"r4"}

The reponse :

Request done, StatusCode #200

{"jsonrpc": "2.0", "id": "r4", "error": {"message": "OpenERP WebClient Error", "code": 300, "data": {"debug": "Client Traceback (most recent call last):\n File \"C:\Program Files (x86)\OpenERP 7.0\Server\server\openerp\addons\web\http.py\", line 204, in dispatch\n File \"C:\Program Files (x86)\OpenERP 7.0\Server\server\openerp\addons\web\controllers\main.py\", line 1056, in search_read\n File \"C:\Program Files (x86)\OpenERP 7.0\Server\server\openerp\addons\web\controllers\main.py\", line 1076, in do_search_read\n File \"C:\Program Files (x86)\OpenERP 7.0\Server\server\openerp\addons\web\session.py\", line 158, in model\nSessionExpiredException: Session expired\n", "type": "client_exception"}}}

Any idea ?

PS : I receive the same response with other requests... :(

Thank you so much.

الصورة الرمزية
إهمال

You need to set the sid cookie value on all JSON requests. You get that value in response to your authenticate request.

@Boris I got same error in JSON. any help??

@boris: have you solve this issue. I have the same.

Hi, have you fine any solution.
I have the same error on odoo 14

أفضل إجابة

Hi,

Sometimes Odoo has limitation to run rpc query, It shown session expired if we look into inspect.
So in this case we can use ajax.jsonRpc. It will run efficiently.

ajax.jsonRpc('/shop/get_dates', 'call',
{ 'sale_id': sale_id }).then(function (result) {
self.dates = result;
});

python

class CheckOutOrders(http.Controller):

@http.route(['/shop/get_dates'], type='json', auth="public", website=True)
def get_enable_date(self, sale_id):
return

Regards

الصورة الرمزية
إهمال
أفضل إجابة

You need to set the sid cookie value on all JSON requests. You get that value in response to your authenticate request.

الصورة الرمزية
إهمال

@James Morgan, I use get2.setHeader("Cookie:","session_id=da4ae8e310eb4ebb8349692f057ecb42"); But I got same error. any help??

@ranjith I have the same issue, did you get a solution?

المنشورات ذات الصلة الردود أدوات العرض النشاط
0
مارس 16
5560
1
مايو 25
1086
0
فبراير 22
3102
2
يناير 22
3256
2
يناير 22
4355