From 51d43c0cd43fa739db644d7c1d1de193c35221ea Mon Sep 17 00:00:00 2001 From: svs-odoo Date: Tue, 17 Mar 2020 10:36:19 +0000 Subject: [PATCH] [FIX] stock: qty on hand display 0 qty product Related to b08e3d114aa4efe687b4d4cca3de462a3dbe6eea Since the related commit, when a product has no available quantity, the button "Update Quantity" and the stat button "Qty. On Hand" doesn't work properly: the view doesn't find the default product(s) and doesn't adapt the fields according to the product (for instance: serial/lot number). To fix that, we need to take also all active product variants of the template, even they have no available quantity. task-2217907 --- addons/stock/models/product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/models/product.py b/addons/stock/models/product.py index 0052e4883b5..79173dbe6b2 100644 --- a/addons/stock/models/product.py +++ b/addons/stock/models/product.py @@ -706,7 +706,7 @@ class ProductTemplate(models.Model): # Be aware that the exact same function exists in product.product def action_open_quants(self): - return self.with_context(active_test=False).product_variant_ids.filtered(lambda p: p.qty_available != 0).action_open_quants() + return self.with_context(active_test=False).product_variant_ids.filtered(lambda p: p.active or p.qty_available != 0).action_open_quants() def action_update_quantity_on_hand(self): advanced_option_groups = [