oca-ocb-web/odoo-bringout-oca-ocb-html_editor/html_editor/models/ir_http.py
Ernad Husremovic f866779561 replace stale web_editor with html_editor and html_builder for 19.0
web_editor was removed in Odoo 19.0 and replaced by html_editor
and html_builder. The old web_editor was incorrectly included in
the 19.0 vanilla import.

🤖 assisted by claude
2026-03-09 15:31:13 +01:00

27 lines
799 B
Python

from odoo import models
from odoo.http import request
CONTEXT_KEYS = ['editable', 'edit_translations', 'translatable']
class IrHttp(models.AbstractModel):
_inherit = "ir.http"
@classmethod
def _get_editor_context(cls):
""" Check for ?editable and stuff in the query-string """
return {
key: True
for key in CONTEXT_KEYS
if key in request.httprequest.args and key not in request.env.context
}
@classmethod
def _pre_dispatch(cls, rule, args):
super()._pre_dispatch(rule, args)
ctx = cls._get_editor_context()
request.update_context(**ctx)
@classmethod
def _get_translation_frontend_modules_name(cls):
return ["html_editor", *super()._get_translation_frontend_modules_name()]