remove followers from Department

This commit is contained in:
Bakry 2024-10-03 18:06:37 +03:00
parent 733d34d67d
commit 5ec1e48aee
1 changed files with 4 additions and 0 deletions

View File

@ -49,6 +49,10 @@ class HrDepartment(models.Model):
will be changed for all employees has with this department"""
for rec in self:
super(HrDepartment, rec).write(vals)
## to remove followers ##
followers = self.env['mail.followers'].search([('res_id', '=', rec.id),('res_model','=','hr.department')])
followers.sudo().unlink()
### end #################
if ('manager_id' or 'parent_id' in vals):
employees = rec.env['hr.employee'].search([('department_id', '=', rec.id)])
for emp in employees: