feat: convert loyalty point creation date to Asia/Jakarta timezone for display
This commit is contained in:
parent
4981764a5f
commit
c9f25b4dae
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user