我需要在type_In
==" In"如果type_In
==" Out"
sum
属性只是添加
<field name="type_In"/>
<field name="Amount_In" sum="Amount total"/>
&#13;
答案 0 :(得分:1)
我认为只有你好的时候才有更好的理由 在javascipt。
尝试添加计算字段。
Amount_value = fields....(compute="_get_amout_value") # same field type as Amount_In
@api.depends('Amount_In')
def get_amout_value(self):
for rec in self:
if rec.type_In == "In":
rec.Amount_value = rec.Amount_In
else :
rec.Amount_value = rec.Amount_In * -1
如果是树:
<field name="type_In"/>
<field name="Amount_value" sum="Amount total"/>