From 23a2bac3fa3aadc473e29adac376c614c983ec6b Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Tue, 16 Jan 2018 14:14:54 +0100 Subject: [PATCH] [FIX] hr_equipment: no technician subscribe in 9.0 In 9.0, an "Human Resources / Employee" see only hr.equipment for which they are set as the "Employee". But the code automatically subscribed the "Technician" because the field name was named technically "user_id" which is automatically subscribed by the system. This led to a possible issue with read / unread message because of feature that just happen by coincidence. For 9.0 only (in 10.0 the field has been renamed technician_user_id and access rules have been changed). opw-805185 closes #22273 --- addons/hr_equipment/models/hr_equipment.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/addons/hr_equipment/models/hr_equipment.py b/addons/hr_equipment/models/hr_equipment.py index 0d48366224f..e542e4c50cd 100644 --- a/addons/hr_equipment/models/hr_equipment.py +++ b/addons/hr_equipment/models/hr_equipment.py @@ -182,6 +182,15 @@ class HrEquipment(models.Model): self.message_subscribe_users(user_ids=user_ids) return super(HrEquipment, self).write(vals) + @api.model + def _message_get_auto_subscribe_fields(self, updated_fields, auto_follow_fields=None): + """ mail.thread override so user_id which has no special access allowance is not + automatically subscribed. + """ + if auto_follow_fields is None: + auto_follow_fields = [] + return super(HrEquipment, self)._message_get_auto_subscribe_fields(updated_fields, auto_follow_fields) + @api.multi def _read_group_category_ids(self, domain, read_group_order=None, access_rights_uid=None): """ Read group customization in order to display all the category in the