In HR modules we have both hr.employee and hr.employee.public models and the
issue is that if a certain user doesn't have access to read the hr.employee
record, it will throw errors/avatar pictures won't appear. For this reason,
https://github.com/odoo/odoo/pull/116828 introduced a change in many2many
employee fields so that they always show hr.employee.public records. However,
we can improve this behavior by checking if the user has access to the record.
If they have access, the private record is shown (making it easier to navigate,
edit employee information) and if they don't have access, we show the public
record. In order to allow forcing a relation, it was decided to convert all
employee fields to accept a relation parameter in the options. If this option
is set, we use that as the relation.
This commit also changes the HR views using these widgets, removing the
relation option from fields that would benefit from this dynamic check for the
most suitable relation.
task-3524305
closesodoo/odoo#136786
Related: odoo/enterprise#48008
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>