Permalink
Browse files

[FIX] hr_fleet: Fix access right on employee form

Purpose
======

Since commit 22ee6eb a user can't access an employee form if he is neither Fleet User nor Manager.
=> Access error: Document model: fleet.vehicle.assignation.log
The reason is the computation of the number of vehicule logs.
A regular user doesn't have access rights on this model.

This commit fixes this.

closes #29835
  • Loading branch information...
Musvol authored and tivisse committed Dec 31, 2018
1 parent f6b1e31 commit 85cb3ffbf117d91b4c9b12b1fa04dae29c000ade
Showing with 1 addition and 1 deletion.
  1. +1 −1 addons/hr_fleet/models/employee.py
@@ -24,7 +24,7 @@ def action_open_employee_cars(self):

def _compute_employee_cars_count(self):
driver_ids = (self.mapped('user_id.partner_id') | self.mapped('address_home_id')).ids
fleet_data = self.env['fleet.vehicle.assignation.log'].read_group(
fleet_data = self.env['fleet.vehicle.assignation.log'].sudo().read_group(
domain=[('driver_id', 'in', driver_ids)], fields=['driver_id'], groupby=['driver_id'])
mapped_data = dict([(m['driver_id'][0], m['driver_id_count']) for m in fleet_data])
for employee in self:

0 comments on commit 85cb3ff

Please sign in to comment.