Files
reporting-engine/sql_request_abstract/controllers/main.py
Sylvain LE GAL 2645c5c394 [MIG] sql_request_abstract from 15.0 to 16.0
- Add new main entry menu for SQL configuration
- Add abstract tree view
- Add abstract form view
- ADD ace/mode-pgsql.js file to have syntaxic coloration in sql field
- move has_grouped_changed from bi_sql_editor to sql_request_abstract
- remove main menu entries, replaced by new spreadsheet menu entries in V16
- update translation
- IMP : inherit from mail.thread to use chatter
- ADD : new note fields
- REF : add comment on has_grouped_changed field
2024-11-12 09:28:37 +07:00

30 lines
1.1 KiB
Python

# Part of Odoo. See LICENSE file for full copyright and licensing details.
import werkzeug
from odoo import http
from odoo.http import request
from odoo.tools.misc import file_open
from odoo.addons.web.controllers.webclient import WebClient
class SqlRequestAbstractWebClient(WebClient):
# if a field, widget="ace" option="{'mode': 'xxx'}"
# is present, The ace lib (odoo/addons/web/static/lib/ace)
# will generate a call to /web/static/lib/ace/mode-xxx.js
# to load the javascript syntax file.
# We catch this call and redirect on the correct path
@http.route("/web/static/lib/ace/mode-pgsql.js", type="http", auth="none")
def call_mode_pgsql_file(self):
return http.Response(
werkzeug.wsgi.wrap_file(
request.httprequest.environ,
file_open("sql_request_abstract/static/lib/ace/mode-pgsql.js", "rb"),
),
content_type="application/javascript; charset=utf-8",
headers=[("Cache-Control", f"max-age={http.STATIC_CACHE}")],
direct_passthrough=True,
)