summaryrefslogtreecommitdiff
path: root/indoteknik_api/controllers/product_controller.py
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_api/controllers/product_controller.py')
-rw-r--r--indoteknik_api/controllers/product_controller.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/indoteknik_api/controllers/product_controller.py b/indoteknik_api/controllers/product_controller.py
index a127b790..0f29971c 100644
--- a/indoteknik_api/controllers/product_controller.py
+++ b/indoteknik_api/controllers/product_controller.py
@@ -86,7 +86,7 @@ class ProductController(controller.Controller):
if active_flash_sale:
flash_sale = {
'banner': base_url + 'api/image/product.pricelist/banner/' + str(active_flash_sale.id) if active_flash_sale.banner else '',
- 'duration': (active_flash_sale.end_date - datetime.now()).total_seconds(),
+ 'duration': round((active_flash_sale.end_date - datetime.now()).total_seconds()),
'products': []
}
product_pricelist_item = request.env['product.pricelist.item'].search([('pricelist_id', '=', active_flash_sale.id)])
@@ -104,6 +104,8 @@ class ProductController(controller.Controller):
'promotion': self.get_promotion_by_product(product),
})
data.update({'flash_sale': flash_sale})
+ else:
+ return self.response(code=404, description='Data not found')
return self.response(data)
def get_stock_by_product(self, product_template: object):