From a2c52e9efd5f97aea56b997f015862840fb0f55e Mon Sep 17 00:00:00 2001 From: Toufik Ben Jaa Date: Wed, 21 Aug 2019 15:03:02 +0000 Subject: [PATCH] [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) --- addons/stock/models/stock_quant.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/models/stock_quant.py b/addons/stock/models/stock_quant.py index 438180fab7b..432c7c9a6db 100644 --- a/addons/stock/models/stock_quant.py +++ b/addons/stock/models/stock_quant.py @@ -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()