From 5ec1e48aee0adfdebb72ef357aa907819a928584 Mon Sep 17 00:00:00 2001 From: Bakry Date: Thu, 3 Oct 2024 18:06:37 +0300 Subject: [PATCH] remove followers from Department --- odex25_hr/hr_base/models/hr_department.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/odex25_hr/hr_base/models/hr_department.py b/odex25_hr/hr_base/models/hr_department.py index 57ad5e5dd..d5d0dd9c5 100644 --- a/odex25_hr/hr_base/models/hr_department.py +++ b/odex25_hr/hr_base/models/hr_department.py @@ -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: