是否有一种方法来显示我们在qweb报告中放置在字段上的标签?
例如
在我的.py里
findings = fields.Text(string="Findings")在我的.xml里
<t t-esc="findings" /> <!-- only shows the value -->我们也能在qweb中得到标签吗?
发布于 2018-11-10 04:43:38
您无法获得该字段的标签。相反,您可以添加html标记来显示标签。
例如:
<p>Your Label <t t-esc="findings" /> </p>
or
<span> Some Text <t t-esc="findings" /> </span>发布于 2018-11-11 11:32:20
您可以使用函数获得字段描述(label),但我鼓励您像在odoo 发票报告中那样显示标签。
要获得date_invoice标签:
def get_field_label(self, model_name, field_name):
ir_model_obj = self.env['ir.model']
ir_model_fields_obj = self.env['ir.model.fields']
model_id = ir_model_obj.search([('model', '=', model_name)], limit=1)
field_id = ir_model_fields_obj.search([('name', '=', field_name), ('model_id', '=', model_id.id)], limit=1)
return field_id.field_descriptionhttps://stackoverflow.com/questions/53228395
复制相似问题