[IMP] web: Add support of js_class attribute for qweb views
Task 2119567
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user