作者:亚璨的秘密 | 来源:互联网 | 2023-01-29 16:26
1> Emipro Techn..:
要在列表视图中启用HTML,您需要覆盖方法_format(),如下所示.(对于Odoo v10)
JS
odoo.define('html_in_tree_field.web_ext', function (require) {
"use strict";
var Listview = require('web.ListView');
var formats = require('web.formats');
Listview.Column.include({
_format: function (row_data, options) {
// Removed _.escape() function to display html content.
// Before : return _.escape(formats.format_value(row_data[this.id].value, this, options.value_if_empty));
return formats.format_value(row_data[this.id].value, this, options.value_if_empty);
}
});
});
要在JS上面添加XML.
__manifest__.py
{
...
...
'data': [
...
'views/above_xml_filename.xml',
],
....
}