diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-01-29 18:35:14 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-01-29 18:35:14 +0100 |
| commit | bdfef60d60d78c5e7360fdabe80e70ea208e6078 (patch) | |
| tree | d6487cd949033dfa7a1f75a5458993336a6e8501 /addons/web_editor/controllers/main.py | |
| parent | 95ef46096110512117a7b7dd9bc797732be36b26 (diff) | |
| parent | cd5c8a02f9560b2a8b5c39182adee7ade1bf595c (diff) | |
[MERGE] forward port branch saas-11.3 up to cd5c8a02f95
Diffstat (limited to 'addons/web_editor/controllers/main.py')
| -rw-r--r-- | addons/web_editor/controllers/main.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/addons/web_editor/controllers/main.py b/addons/web_editor/controllers/main.py index 7bb6f77a649..5c7b5316d44 100644 --- a/addons/web_editor/controllers/main.py +++ b/addons/web_editor/controllers/main.py @@ -51,11 +51,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) |
