summaryrefslogtreecommitdiff
path: root/indoteknik_api/controllers/api_v1
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-01-23 10:52:49 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-01-23 10:52:49 +0700
commit4bc68435bc20d7da0f38bd2370057481cb995584 (patch)
treecfe51565a46fc43fe5d674a65be0b57b9555620f /indoteknik_api/controllers/api_v1
parentc54083f55d4d1990d8325fff063896b3bc0f6fb2 (diff)
add dynamic limit for new product
Diffstat (limited to 'indoteknik_api/controllers/api_v1')
-rw-r--r--indoteknik_api/controllers/api_v1/product.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/indoteknik_api/controllers/api_v1/product.py b/indoteknik_api/controllers/api_v1/product.py
index cfa2dbef..23dcf48e 100644
--- a/indoteknik_api/controllers/api_v1/product.py
+++ b/indoteknik_api/controllers/api_v1/product.py
@@ -19,6 +19,8 @@ class Product(controller.Controller):
is_brand_only = int(kw.get('is_brand_only', 0))
base_url = request.env['ir.config_parameter'].get_param('web.base.url')
+ limit_new_products = request.env['ir.config_parameter'].get_param('limit.new.product')
+ limit_new_products = int(limit_new_products)
# current_time = datetime.now()
# delta_time = current_time - timedelta(days=30)
@@ -32,7 +34,7 @@ class Product(controller.Controller):
('x_manufacture', '!=', False),
# ('create_date', '>=', delta_time),
]
- new_products = request.env['product.template'].search(query_products, order='create_date desc', limit=250)
+ new_products = request.env['product.template'].search(query_products, order='create_date desc', limit=limit_new_products)
brands = []
for product in new_products:
brands.append(product.x_manufacture)