summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 f819e85ad84..ed914734021 100644
--- a/addons/stock/models/stock_quant.py
+++ b/addons/stock/models/stock_quant.py
@@ -507,7 +507,7 @@ class StockQuant(models.Model):
"""
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;"""
+ query = """SELECT id FROM stock_quant WHERE (round(quantity::numeric, %s) = 0 OR quantity IS NULL) AND round(reserved_quantity::numeric, %s) = 0;"""
params = (precision_digits, precision_digits)
self.env.cr.execute(query, params)
quant_ids = self.env['stock.quant'].browse([quant['id'] for quant in self.env.cr.dictfetchall()])