diff --git a/controllers/main.py b/controllers/main.py index 9980744..e4b8d07 100644 --- a/controllers/main.py +++ b/controllers/main.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import pytz from odoo import http from odoo.http import request @@ -261,9 +262,19 @@ class AppNotificationController(http.Controller): program_type = card_info.get('program_type') or 'loyalty' program_name = card_info.get('program_name') or '' + create_date = rec.get('create_date') + if create_date: + if create_date.tzinfo is None: + create_date = pytz.utc.localize(create_date) + wib_tz = pytz.timezone('Asia/Jakarta') + create_date = create_date.astimezone(wib_tz) + date_str = create_date.strftime('%Y-%m-%d %H:%M:%S') + else: + date_str = '' + result.append({ 'id': rec['id'], - 'date': str(rec.get('create_date') or ''), + 'date': date_str, 'points': round(float(points), 2), 'type': point_type, 'order_ref': order_ref,