summaryrefslogtreecommitdiff
path: root/addons/web/models
diff options
context:
space:
mode:
authorLucas Lefèvre <lul@odoo.com>2019-11-15 13:38:06 +0100
committerLucas Lefèvre <lul@odoo.com>2020-01-21 13:16:58 +0100
commit3519b9872ece1337ca0d008fbfa032a8005c35af (patch)
treea87f0acd5489070bc6462352869565d017902f2c /addons/web/models
parent8b89f63d2c14d7df15e2618a2847702930037118 (diff)
[IMP] web: Add support of js_class attribute for qweb views
Task 2119567
Diffstat (limited to 'addons/web/models')
-rw-r--r--addons/web/models/models.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/web/models/models.py b/addons/web/models/models.py
index 0d03d950b9f..3a70ab4f0c8 100644
--- a/addons/web/models/models.py
+++ b/addons/web/models/models.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import babel.dates
import pytz
+from lxml import etree
from odoo import _, api, fields, models
from odoo.osv.expression import AND
@@ -202,9 +203,11 @@ class Base(models.AbstractModel):
def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):
r = super().fields_view_get(view_id, view_type, toolbar, submenu)
# avoid leaking the raw (un-rendered) template, also avoids bloating
- # the response payload for no reason
+ # the response payload for no reason. Only send the root node,
+ # to send attributes such as `js_class`.
if r['type'] == 'qweb':
- r['arch'] = '<qweb/>'
+ root = etree.fromstring(r['arch'])
+ r['arch'] = etree.tostring(etree.Element('qweb', root.attrib))
return r
@api.model