summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorArnold Moyaux <arm@odoo.com>2019-07-11 12:45:15 +0000
committerArnold Moyaux <arm@odoo.com>2019-07-12 11:37:13 +0000
commit6b8a0beda65dce688ecd0ee34828097b67a13dab (patch)
tree0ee9a2945d2fcbdb84d217c0ed4fedb52b6f503e /addons
parentec02ca91760a9f1bda2eec0c703ddf20d6a4734b (diff)
[FIX] stock: access error on stock.quant
Usecase to reproduce: - Connect on demo user (inventory user) - Go on product page and click on stat button for 'quantity on hand' > AccessError on decimal.precision object due to commit a1eb000c93a5a64b3041c48ed9b1eaf3c03257d3 When the user click on 'report inventory' button it will garbage collect the remaining quants without quantity. In order to do it, it needs the precision rounding in order to have a rounding and do not let quant without significant quantity. closes odoo/odoo#34780 Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Diffstat (limited to 'addons')
-rw-r--r--addons/stock/models/stock_quant.py2
1 files changed, 1 insertions, 1 deletions
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)