假设有这样一个模型
class HolidaysType(models.Model):
_name = "hr.holidays.status"
_description = "Leave Type"
有类似的方法
api.one
@api.depends('b')
def _compute_amount(self):
a = b
m = n
h = f
pass
我需要添加一个继承模型为:
class modelname(models.Model):
_inherit = 'hr.holidays.status'
然后我需要在_compute_amount方法中使c = x + z和a = b + c
我怎样才能做到这一点
重写_compute_amount
方法并添加代码。
class modelname(models.Model):
_inherit = 'hr.holidays.status'
@api.one
@api.depends('b')
def _compute_amount(self):
super(modelname, self)._compute_amount()
c = x+z
a = b+c
创建一个新记录以检查值是否正确计算。
您可以重新计算存储的功能字段值。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句