diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2023-01-23 10:52:49 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2023-01-23 10:52:49 +0700 |
| commit | 4bc68435bc20d7da0f38bd2370057481cb995584 (patch) | |
| tree | cfe51565a46fc43fe5d674a65be0b57b9555620f | |
| parent | c54083f55d4d1990d8325fff063896b3bc0f6fb2 (diff) | |
add dynamic limit for new product
| -rw-r--r-- | indoteknik_api/controllers/api_v1/product.py | 4 | ||||
| -rwxr-xr-x | indoteknik_custom/models/user_activity_log.py | 2 |
2 files changed, 4 insertions, 2 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) diff --git a/indoteknik_custom/models/user_activity_log.py b/indoteknik_custom/models/user_activity_log.py index 16084037..32b389a1 100755 --- a/indoteknik_custom/models/user_activity_log.py +++ b/indoteknik_custom/models/user_activity_log.py @@ -71,7 +71,7 @@ class UserActivityLog(models.Model): ('url', 'ilike', 'https://indoteknik.co%/shop/product/%'), ('create_date', '>', delta_time), ('url', 'not ilike', 'shopping'), - ], limit=4000) + ], limit=1000) for activity_log in activity_logs: _logger.info(activity_log.url) strip_index = i = 0 |
