summaryrefslogtreecommitdiff
path: root/indoteknik_api
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-07-27 13:31:43 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-07-27 13:31:43 +0700
commita7057cc2fd5bd800d7b75f101aec9b67cdbe0053 (patch)
treea667e67b3b3fa490ca65b3d9ee0b6cb81d9d70b7 /indoteknik_api
parent9166e4dfc6c42aed768e333b0f0c9be016c44d72 (diff)
<iman> update numFound not published
Diffstat (limited to 'indoteknik_api')
-rw-r--r--indoteknik_api/controllers/api_v1/category.py3
1 files changed, 2 insertions, 1 deletions
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