odoo/odoo#202987

Created by fw-bot
Merged at f2369aaacf4a0f144fdc513340649ac72678bc2b

Statuses:

label
odoo-dev:saas-17.4-17.0-opw-4539017-commercial_partner_id-access-rights-azey-423390-fw
head
44ed982e008bc416cd2b9b54b002635db0ea913f
merged
6 months ago by Abdelaziz EL HAYYANY (azey)
odoo/odoo
17.0 #202033
saas-17.4 #202987
18.0 #202995
saas-18.1 #203007
saas-18.2 #203014

[FW][FIX] hr_expense: prevent access error when checking vendor bill warning

When a user tries to access a vendor bill where the vendor is their own company, Odoo displays a warning indicating that the user is trying to invoice themselves. To determine whether to show this warning, we check if the partner has any related employee_ids.

However, if the user does not have the "Employees / Officer: Manage all employees" access rights, they cannot check the employee_ids, leading to an access error when opening the vendor bill.

Steps to Reproduce:
1. Create a vendor bill where the vendor is set to your own company.
2. Try to access the vendor bill with a user who does not have "Employees / Officer: Manage all employees" access rights. Issue: An error occurs because the user lacks permission to check the related employee_ids for the vendor.
Refer to this video for clearer steps.
opw-4539017


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

Forward-Port-Of: #202033