raise ValidationError后修改字段值
-
如下,我想在
raise
之后,想修改state_sourcing的字段值为原来的noaction,怎么实现?@api.multi @api.onchange('state_dfs', 'state_sourcing', 'state_planning') def _set_state(self): for rec in self: sourcing = rec.action_ids.filtered(lambda r: r.type == "sourcing") if not sourcing: if rec.state_sourcing != 'noaction': raise ValidationError('There is no sourcing action!')
-
raise 相当于给出错误信息,error。所有执行的代码全部回滚,也就是全部无效,