diff --git a/yuthon_holiday/models/inherit_hr_leave.py b/yuthon_holiday/models/inherit_hr_leave.py index a8d173e67..868555c35 100644 --- a/yuthon_holiday/models/inherit_hr_leave.py +++ b/yuthon_holiday/models/inherit_hr_leave.py @@ -70,10 +70,10 @@ class HrLeave(models.Model): @api.ondelete(at_uninstall=False) def _unlink_if_correct_states(self): """重写删除校验:先将请假单改为拒绝状态,再执行原生校验/删除""" - to_cancel_leaves = self.filtered(lambda r: r.state != 'cancel') + to_cancel_leaves = self.filtered(lambda r: r.state != 'refuse') if to_cancel_leaves: to_cancel_leaves.write({ - 'state': 'cancel', + 'state': 'refuse', 'notes': _('%s:删除前自动标记为拒绝') % fields.Datetime.now() }) error_message = _('You cannot delete a time off which is in %s state')