[IMP] stock: assign quantities to services in batch

Since 2137e45bb5, 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 <amoyaux@users.noreply.github.com>
This commit is contained in:
William Henrotin
2019-08-29 08:05:37 +00:00
parent 695c65131b
commit 238e5ed9ca
+7 -6
View File
@@ -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 """