summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2023-08-04 06:53:58 +0000
committerIT Fixcomart <it@fixcomart.co.id>2023-08-04 06:53:58 +0000
commit0a334d22de6cad94db8a501eca210450f91cde74 (patch)
tree176671afe8499d98e5dfadd9d11e2c20e5d0653e
parent598b9cb31cf5fc8a6fb67f55175ad14c4ec64765 (diff)
parent99782534a66b3db276bb2c973e75b976a22ba864 (diff)
Merged in development (pull request #84)
Update category homepage show product from product_ids
-rw-r--r--indoteknik_api/controllers/api_v1/category.py14
1 files changed, 1 insertions, 13 deletions
diff --git a/indoteknik_api/controllers/api_v1/category.py b/indoteknik_api/controllers/api_v1/category.py
index b5e01d4e..22b5cb44 100644
--- a/indoteknik_api/controllers/api_v1/category.py
+++ b/indoteknik_api/controllers/api_v1/category.py
@@ -69,17 +69,7 @@ class Category(controller.Controller):
categories = request.env['website.categories.homepage'].search(query, order='sequence')
data = []
for category in categories:
- query_product = [
- ('active', '=', True),
- ('type', '=', 'product'),
- ('product_rating', '>', 0),
- ('public_categ_ids', 'child_of', [category.category_id.id])
- ]
- products = request.env['product.template'].search(query_product, order='product_rating desc', limit=12)
- # product_brands = []
- brands = request.env['x_manufactures'].search([
- ('product_tmpl_ids.public_categ_ids', 'child_of', [category.category_id.id])
- ], limit=8)
+ products = category.product_ids
data.append({
'id': category.id,
@@ -88,8 +78,6 @@ class Category(controller.Controller):
'name': category.category_id.name,
'image': request.env['ir.attachment'].api_image('website.categories.homepage', 'image', category.id),
'url': category.url,
- # 'brands': [y.x_name for y in brands],
- 'brands': [request.env['x_manufactures'].api_single_response(y) for y in brands],
'products': [request.env['product.template'].api_single_response(x) for x in products]
})
return self.response(data, headers=[('Cache-Control', 'max-age=3600, public')])