[FIX] attendances: FIX bug
This commit is contained in:
parent
7f2833113d
commit
27f093bcb7
|
|
@ -60,7 +60,7 @@ class HrAttendanceReport(models.Model):
|
|||
|
||||
def unlink(self):
|
||||
for rec in self:
|
||||
if rec.state != 'draft':
|
||||
if rec.state != 'draft' and not self._context.get('can_delete'):
|
||||
raise exceptions.Warning(_('You can not delete record in state not in draft'))
|
||||
return super(HrAttendanceReport, self).unlink()
|
||||
|
||||
|
|
@ -466,7 +466,7 @@ class HrAttendanceReport(models.Model):
|
|||
'additional_hours': sum_line.additional_hours + sum(sum_recs.mapped('line_ids.additional_hours')),
|
||||
})
|
||||
|
||||
recs.unlink()
|
||||
recs.with_context(can_delete=True).unlink()
|
||||
def _get_email_template(self):
|
||||
return self.env.ref('attendances.emapproval_line')
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue