[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
This commit is contained in:
Nicolas Lempereur
2018-01-16 15:09:45 +01:00
parent 11c73cd0aa
commit 23a2bac3fa
@@ -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