diff --git a/addons/stock/models/stock_quant.py b/addons/stock/models/stock_quant.py index 4c229a89304..14c6cc77aae 100644 --- a/addons/stock/models/stock_quant.py +++ b/addons/stock/models/stock_quant.py @@ -443,7 +443,7 @@ class StockQuant(models.Model): this method is often called in batch and each unlink invalidate the cache. We defer the calls to unlink in this method. """ - precision_digits = max(6, self.env.ref('product.decimal_product_uom').digits * 2) + precision_digits = max(6, self.sudo().env.ref('product.decimal_product_uom').digits * 2) # Use a select instead of ORM search for UoM robustness. query = """SELECT id FROM stock_quant WHERE round(quantity::numeric, %s) = 0 AND round(reserved_quantity::numeric, %s) = 0;""" params = (precision_digits, precision_digits)