[FIX] stock: remove a useless with_user

- Before the change of `sudo` and `with_user` the code was non sense, it
was doing a `self.sudo(self._uid).check_access_rights('read')` which
was doing nothing.

But now with `with_user`, doing a `self.with_user(self._uid).check_access_rights('read')` breaks the
flag `superuser`.
Meaning that if the code was called using `sudo` it was bypassing the
ACL tests.

closes odoo/odoo#35896

Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
This commit is contained in:
Toufik Ben Jaa
2019-08-21 15:03:02 +00:00
parent 0fe9a9ddd1
commit a2c52e9efd
+1 -1
View File
@@ -255,7 +255,7 @@ class StockQuant(models.Model):
domain = expression.AND([[('location_id', '=', location_id.id)], domain])
# Copy code of _search for special NULLS FIRST/LAST order
self.with_user(self._uid).check_access_rights('read')
self.check_access_rights('read')
query = self._where_calc(domain)
self._apply_ir_rules(query, 'read')
from_clause, where_clause, where_clause_params = query.get_sql()