summaryrefslogtreecommitdiff
path: root/addons/web_editor/controllers
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-01-29 13:17:12 +0100
committerChristophe Simonis <chs@odoo.com>2019-01-29 13:17:12 +0100
commitcd5c8a02f9560b2a8b5c39182adee7ade1bf595c (patch)
treec654b3d46020aa30fcc7c2724d200a93a807859b /addons/web_editor/controllers
parent6c6ef6588fc374e86acdeeacba2842690b6f1a53 (diff)
parent36d96e015032d42449fe149c050df75050276fdc (diff)
[MERGE] forward port branch 11.0 up to 36d96e01503
Diffstat (limited to 'addons/web_editor/controllers')
-rw-r--r--addons/web_editor/controllers/main.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/addons/web_editor/controllers/main.py b/addons/web_editor/controllers/main.py
index 3d938517b29..0950ce513da 100644
--- a/addons/web_editor/controllers/main.py
+++ b/addons/web_editor/controllers/main.py
@@ -50,11 +50,16 @@ class Web_Editor(http.Controller):
kwargs.update(trans)
- record = None
- if model and kwargs.get('res_id'):
- record = request.env[model].with_context(trans).browse(kwargs.get('res_id'))
+ content = None
+ if model:
+ Model = request.env[model].with_context(trans)
+ if kwargs.get('res_id'):
+ record = Model.browse(kwargs.get('res_id'))
+ content = record and getattr(record, field)
+ else:
+ content = Model.default_get([field]).get(field)
- kwargs.update(content=record and getattr(record, field) or "")
+ kwargs.update(content=content or '')
return request.render(kwargs.get("template") or "web_editor.FieldTextHtml", kwargs, uid=request.uid)