diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2023-08-04 03:59:33 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2023-08-04 03:59:33 +0000 |
| commit | 6d17228cd6c789fe4460e28807d5b39fb1bbe9b7 (patch) | |
| tree | a4c961062c026e1005ebdc82547903c3f30c0a06 /indoteknik_api/controllers/api_v1/flash_sale.py | |
| parent | cc182dd9963fb8985661ca1b64a53e7f11f095c5 (diff) | |
| parent | bcc35009da39e9ee8b5e181006d3690316b83c59 (diff) | |
Merged in development (pull request #82)
Development
Diffstat (limited to 'indoteknik_api/controllers/api_v1/flash_sale.py')
| -rw-r--r-- | indoteknik_api/controllers/api_v1/flash_sale.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/indoteknik_api/controllers/api_v1/flash_sale.py b/indoteknik_api/controllers/api_v1/flash_sale.py index dc7c3928..dff8bec3 100644 --- a/indoteknik_api/controllers/api_v1/flash_sale.py +++ b/indoteknik_api/controllers/api_v1/flash_sale.py @@ -1,4 +1,3 @@ -from datetime import datetime import logging from .. import controller from odoo import http @@ -28,7 +27,7 @@ class FlashSale(controller.Controller): 'banner': request.env['ir.attachment'].api_image('product.pricelist', 'banner', pricelist.id), 'banner_mobile': request.env['ir.attachment'].api_image('product.pricelist', 'banner_mobile', pricelist.id), 'banner_top': request.env['ir.attachment'].api_image('product.pricelist', 'banner_top', pricelist.id), - 'duration': round((pricelist.end_date - datetime.now()).total_seconds()), + 'duration': pricelist._remaining_time_in_second(), 'product_total': request.env['product.pricelist.item'].search_count(query), }) return self.response(data) @@ -94,7 +93,7 @@ class FlashSale(controller.Controller): 'name': active_flash_sale.name, 'banner': base_url + 'api/image/product.pricelist/banner/' + str(active_flash_sale.id) if active_flash_sale.banner else '', 'banner_mobile': base_url + 'api/image/product.pricelist/banner_mobile/' + str(active_flash_sale.id) if active_flash_sale.banner_mobile else '', - 'duration': round((active_flash_sale.end_date - datetime.now()).total_seconds()), + 'duration': active_flash_sale._remaining_time_in_second(), 'flashsale_option': active_flash_sale.flashsale_option, 'product_total': request.env['product.template'].search_count(query), 'products': [request.env['product.template'].api_single_response(x) for x in product_templates] |
