Merge pull request #5780 from expsa/younes_dev_odex25_hr
[FIX] attendances: FIX bug
This commit is contained in:
commit
2b1ca19234
|
|
@ -60,7 +60,7 @@ class HrAttendanceReport(models.Model):
|
||||||
|
|
||||||
def unlink(self):
|
def unlink(self):
|
||||||
for rec in 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'))
|
raise exceptions.Warning(_('You can not delete record in state not in draft'))
|
||||||
return super(HrAttendanceReport, self).unlink()
|
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')),
|
'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):
|
def _get_email_template(self):
|
||||||
return self.env.ref('attendances.emapproval_line')
|
return self.env.ref('attendances.emapproval_line')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue