Skip to content

Commit 634a4ee

Browse files
[MIG] hr_timesheet_sheet: Use @api.ondelete() instead of unlink() to guard sheet
1 parent 30764a4 commit 634a4ee

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

hr_timesheet_sheet/models/hr_timesheet_sheet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,8 @@ def write(self, vals):
524524
rec.delete_empty_lines(True)
525525
return res
526526

527-
def unlink(self):
527+
@api.ondelete(at_uninstall=False)
528+
def _unlink_except_state_confirm_or_done(self):
528529
for sheet in self:
529530
if sheet.state in ("confirm", "done"):
530531
raise UserError(
@@ -534,7 +535,6 @@ def unlink(self):
534535
sheet.complete_name,
535536
)
536537
)
537-
return super().unlink()
538538

539539
def onchange(self, values, field_name, field_onchange):
540540
"""

0 commit comments

Comments
 (0)