From a7057cc2fd5bd800d7b75f101aec9b67cdbe0053 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Sat, 27 Jul 2024 13:31:43 +0700 Subject: update numFound not published --- indoteknik_api/controllers/api_v1/category.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indoteknik_api/controllers/api_v1') diff --git a/indoteknik_api/controllers/api_v1/category.py b/indoteknik_api/controllers/api_v1/category.py index a673e42f..09b8ff8c 100644 --- a/indoteknik_api/controllers/api_v1/category.py +++ b/indoteknik_api/controllers/api_v1/category.py @@ -62,7 +62,8 @@ class Category(controller.Controller): if depth > 2: return 0 child_categories = request.env['product.public.category'].search([('parent_frontend_id', '=', category.id)]) - num_found = len(category.product_tmpl_ids) + # Fetch products that are not unpublished + num_found = len(category.product_tmpl_ids.filtered(lambda p: not p.unpublished)) for child in child_categories: num_found += compute_num_found(child, depth + 1, start_depth) return num_found -- cgit v1.2.3