在我的创建函数结束时,我需要给Amount_entered
默认值
@api.model
def create(self, vals):
.....
.....
....
vals['Amount_entered'] = default value????
return record
答案 0 :(得分:4)
对于默认值,您应该使用(这是正确的,推荐的方式)
field_name = fields.Field(default=function/value)
在您的情况下,正确(正确但不推荐)的代码将如下所示
@api.model
def create(self, vals):
vals['field'] = value
record = super(module_name, self).create(vals)
return record
或
@api.model
def create(self, vals):
record = super(module_name, self).create(vals)
record.field = value
return record