ValueError:Compute method failed to assign stock.move.line(12891,).is_lot
这是报错的代码
@api.depends('move_id.product_id.tracking')
def _compute_is_lot(self):
for rec in self:
if rec.move_id.product_id.tracking == 'lot':
rec.is_lot = True
修改之后,加个else
@api.depends('move_id.product_id.tracking')
def _compute_is_lot(self):
for rec in self:
if rec.move_id.product_id.tracking == 'lot':
rec.is_lot = True
else:
rec.is_lot = False