2026-01-31 08:29:51 -05:00

16 lines
717 B
Python

from odoo import http
from odoo.http import request
import json
class CorsHandler(http.Controller):
# This specifically targets the authentication endpoint for CORS
@http.route('/web/session/authenticate', type='json', auth="none", cors="*")
def authenticate_cors(self, db, login, password, base_location=None):
request.session.authenticate(db, login, password)
return request.env['ir.http'].session_info()
# Generic search_read for the dashboard apps
@http.route('/web/dataset/call_kw', type='json', auth="user", cors="*")
def call_kw_cors(self, model, method, args, kwargs, path=None):
return request.env[model].with_user(request.uid).call_kw(method, args, kwargs)