From 238e5ed9ca14a09ec8dd09dd04040580b6980931 Mon Sep 17 00:00:00 2001 From: William Henrotin Date: Thu, 22 Aug 2019 12:28:37 +0000 Subject: [PATCH] [IMP] stock: assign quantities to services in batch Since 2137e45bb5e5bd28e6f14a1c4b269d1e63b4f7ab, services have their stock quantities computed to 0. As it's the same value for all of them, we can do it in one batch instead of iterating over products. closes odoo/odoo#36214 Signed-off-by: Arnold Moyaux --- addons/stock/models/product.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/addons/stock/models/product.py b/addons/stock/models/product.py index 0a0c6faf05a..5fa1a87e924 100644 --- a/addons/stock/models/product.py +++ b/addons/stock/models/product.py @@ -102,12 +102,13 @@ class Product(models.Model): product.outgoing_qty = res[product.id]['outgoing_qty'] product.virtual_available = res[product.id]['virtual_available'] product.free_qty = res[product.id]['free_qty'] - for product in self - products: - product.qty_available = 0.0 - product.incoming_qty = 0.0 - product.outgoing_qty = 0.0 - product.virtual_available = 0.0 - product.free_qty = 0.0 + # Services need to be set with 0.0 for all quantities + services = self - products + services.qty_available = 0.0 + services.incoming_qty = 0.0 + services.outgoing_qty = 0.0 + services.virtual_available = 0.0 + services.free_qty = 0.0 def _product_available(self, field_names=None, arg=False): """ Compatibility method """