Odoo 13 如何使用代码中的 Html 小部件编辑字段?

问题描述

我有描述字段:

test_field = fields.Char(string='Test')

在 XML 格式中,它看起来像这样:

<field name="test_field" widget="html" />

问题是如何将带有某些值的表格行从代码插入到此字段?

我尝试将 html 标记编写为这样的文本:

enter image description here

但它包装为段落并显示为普通文本。

解决方法

您的字段定义应如下所示:

test_field = fields.Html(string='Test')