我试图在 xml 上显示该字段。但是,问题是?它没有显示的字段。这是我的代码:
xml file.
<tr>
<td class="bottom_border_only" ><span t-field="o.test_field_function"/></td>
</tr>
python 文件
def test_function(self,cr,uid,ids,origin, args, context=None) :
print "success"
'test_field_function' : fields.function(test_function, method=True, string='data_po', type='char', store=True),
请您参考如下方法:
您的字段永远不会像您声明的那样具有值。在函数中,您需要设置我正在使用手机的字段的值,但在新的 api 中,函数应该是这样的。
@depends('some_field')
def test_function(self) :
for rec in self:
# loop because self can have more than one record
rec. test_field_function = "success"
打印消息只会将它打印到 stdout 女巫是控制台检查 odoo 代码以查看如何使用计算字段有很多是开源的,你可以找到由专业人士编写的优雅代码
