odoo 开发者模式添加计算字段
1\依赖为需要取值的字段,中间用逗号隔开:
x_studio_,x_studio__1,x_studio_03
2\计算逻辑:
for record in self:
record['x_studio__3'] = record.x_studio_/(record.x_studio_+record.x_studio_03)
注意:
第二行要空四格。
来自啊鹤:
Walter:
x_weight,x_studio_wg,product_uom_qty
Walter:
for record in self:
record['x_weight']=record.x_studio_wg*record.product_uom_qty
学着画一画:
来一个除法的:
来自雪峰大神的指导
因为分母不能为0,做一个计算
依赖
for record in self: if record.x_studio_2_1 != 0: record['x_lingpinK'] = record.x_studio_g_4/record.x_studio_2_1 else: record['x_lingpinK'] = 0