Skip to content

Commit

Permalink
[FIX] hr_maintenance: use hr.employee -> .public when missing rights
Browse files Browse the repository at this point in the history
Steps to reproduce
==================

- Login as a user with no rights
- Use a mobile viewport
- Create a new Maintenance Request
- Edit the Created By field

-> A traceback occurs because the user has no rights

Solution
========

We extend the Many2OneField to accept a relation option and Depending on
whether the user has the rights, use the correct one.

This is similar to 41eaff0

opw-3430105

closes odoo#133261

X-original-commit: e78998c
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
  • Loading branch information
hubvd committed Aug 28, 2023
1 parent 2c54f58 commit c2b93f7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion addons/hr_maintenance/views/maintenance_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@
<field name="arch" type="xml">
<xpath expr="//field[@name='owner_user_id']" position="replace">
<field name="employee_id" string="Created By"
options="{'no_create_edit': True, 'no_open': True}"/>
widget="many2one_avatar_employee"
options="{'no_create_edit': True, 'no_open': True, 'relation': 'hr.employee.public'}"
groups="!hr.group_hr_user"/>
<field name="employee_id" string="Created By"
widget="many2one_avatar_employee"
options="{'no_create_edit': True, 'no_open': True, 'relation': 'hr.employee'}"
groups="hr.group_hr_user"/>
</xpath>
</field>
</record>
Expand Down

0 comments on commit c2b93f7

Please sign in to comment.