Skip to content

Instantly share code, notes, and snippets.

@hari4274
Created November 24, 2019 18:32
Show Gist options
  • Save hari4274/fc7ab11b849a88a4eb5631872c01cc4a to your computer and use it in GitHub Desktop.
Save hari4274/fc7ab11b849a88a4eb5631872c01cc4a to your computer and use it in GitHub Desktop.
To enable session_id in session/authenticate JSON-RPC call in odoo13 and above
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
from odoo.http import request
class Http(models.AbstractModel):
_inherit = 'ir.http'
def session_info(self):
res = super(Http, self).session_info()
if not res.get('session_id'):
# Add Session Id
res['session_id'] = request.session.sid
return res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment