我需要存储一个计算字段,这样我就可以在树状视图中的groupby中使用它,问题是一旦我添加store=True,该字段就不能更新并返回0@api.依赖在
注:amount_total也是一个计算字段,所以可能这就是问题所在,请帮助我
这是我的代码:
@api.one
@api.depends('amount_total')
def check_negatif_or_positif(self):
if (self.picking_type_id.name =='Receptions'):
self.amount_calcul = self.amount_total * (-1)
else:
self.amount_calcul = self.amount_total
amount_calcul= fields.Float(compute='check_negatif_or_positif ,string='Amount' ,store=True)
谢谢
要存储计算字段,请在字段中指定readonly=False。在
相关问题 更多 >
编程相关推荐