fix
This commit is contained in:
parent
019f2e1f2d
commit
176c5461ea
|
|
@ -28,7 +28,7 @@ class HrAttendanceTransactions(models.Model):
|
|||
carried_hours = fields.Float(string='Carried Hours', default=0)
|
||||
temp_exit = fields.Float(string='Temporary Exit Hours')
|
||||
temp_lateness = fields.Float(string='Temporary Lateness Hours')
|
||||
additional_hours = fields.Float(compute='get_additional_hours', string='Additional Hours', default=0)
|
||||
additional_hours = fields.Float(compute='get_additional_hours', string='Additional Hours', default=0, store=True)
|
||||
|
||||
sequence = fields.Integer()
|
||||
attending_type = fields.Selection([('in_cal', 'within Calendar'),
|
||||
|
|
|
|||
|
|
@ -94,6 +94,13 @@ class HRHolidays(models.Model):
|
|||
request_done = fields.Boolean(default=False,readonly=True)
|
||||
is_branch = fields.Many2one(related='department_id.branch_name', store=True, readonly=True)
|
||||
|
||||
## to remove followers ##
|
||||
def _remove_followers_holiday(self):
|
||||
for rec in self:
|
||||
followers = self.env['mail.followers'].search(
|
||||
[('res_id', '=', rec.id),('res_model','=','hr.holidays')])
|
||||
followers.sudo().unlink()
|
||||
|
||||
|
||||
def _check_state_access_right(self, vals):
|
||||
if vals.get('state') and vals['state'] not in ['draft', 'confirm', 'cancel'] and not \
|
||||
|
|
@ -143,6 +150,7 @@ class HRHolidays(models.Model):
|
|||
@api.depends('date_from','date_to', 'holiday_status_id')
|
||||
def _leave_balance_date(self):
|
||||
for rec in self:
|
||||
rec._remove_followers_holiday()
|
||||
to_work_days = 0
|
||||
to_work_days2 = 0
|
||||
leave = rec.holiday_status_id
|
||||
|
|
@ -1276,6 +1284,7 @@ class HRHolidays(models.Model):
|
|||
|
||||
def draft_state(self):
|
||||
for item in self:
|
||||
item._remove_followers_holiday()
|
||||
have_cancel_request = self.env['leave.cancellation'].search([('leave_request_id', '=', item.id),
|
||||
('state', 'not in', ('draft', 'refuse'))])
|
||||
have_return_from_leave = self.env['return.from.leave'].search(
|
||||
|
|
@ -1309,6 +1318,7 @@ class HRHolidays(models.Model):
|
|||
def confirm(self):
|
||||
for item in self:
|
||||
self._compute_leave_balance()
|
||||
item._remove_followers_holiday()
|
||||
## ticket allowance per year ###
|
||||
if item.issuing_ticket == 'yes':
|
||||
current_date = (datetime.utcnow() + timedelta(hours=3)).date()
|
||||
|
|
@ -1369,6 +1379,7 @@ class HRHolidays(models.Model):
|
|||
|
||||
def hr_manager(self):
|
||||
self._compute_leave_balance()
|
||||
self._remove_followers_holiday()
|
||||
if not self.replace_by and self.type == 'remove':
|
||||
if self.holiday_status_id.alternative_chick == True:
|
||||
raise exceptions.Warning(_('Select employee Replacement before The approve holiday Request'))
|
||||
|
|
@ -1406,6 +1417,7 @@ class HRHolidays(models.Model):
|
|||
|
||||
def financial_manager(self):
|
||||
for item in self:
|
||||
item._remove_followers_holiday()
|
||||
if not item.replace_by and item.type == 'remove':
|
||||
if item.holiday_status_id.alternative_chick == True:
|
||||
raise exceptions.Warning(_('Select employee Replacement before The approve holiday Request'))
|
||||
|
|
@ -1601,6 +1613,7 @@ class HRHolidays(models.Model):
|
|||
|
||||
def refuse(self):
|
||||
for item in self:
|
||||
item._remove_followers_holiday()
|
||||
have_cancel_request = self.env['leave.cancellation'].search(
|
||||
[('leave_request_id', '=', item.id), ('state', 'not in', ('draft', 'refuse'))])
|
||||
have_return_from_leave = self.env['return.from.leave'].search(
|
||||
|
|
|
|||
Loading…
Reference in New Issue