first push message
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import json
|
||||
from odoo import http
|
||||
from odoo.http import request
|
||||
|
||||
|
||||
class SurveyDashboardController(http.Controller):
|
||||
|
||||
@http.route('/survey/dashboard/<int:survey_id>', type='http', auth='user', website=True)
|
||||
def dashboard_view(self, survey_id, **kw):
|
||||
survey = request.env['survey.survey'].sudo().browse(survey_id).exists()
|
||||
if not survey:
|
||||
return request.not_found()
|
||||
|
||||
# Get data from model
|
||||
data = survey.get_dashboard_data()
|
||||
|
||||
# ✅ CRITICAL: Serialize to JSON string with UTF-8 support for Khmer text
|
||||
data['questions_json'] = json.dumps(
|
||||
data.get('questions', []),
|
||||
default=str,
|
||||
ensure_ascii=False
|
||||
)
|
||||
|
||||
return request.render('dashboard_survey.dashboard_template', data)
|
||||
Reference in New Issue
Block a user