first push message
This commit is contained in:
@@ -0,0 +1 @@
|
||||
from . import main
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,21 @@
|
||||
# from odoo import http
|
||||
|
||||
|
||||
# class DashboardSurvey(http.Controller):
|
||||
# @http.route('/dashboard_survey/dashboard_survey', auth='public')
|
||||
# def index(self, **kw):
|
||||
# return "Hello, world"
|
||||
|
||||
# @http.route('/dashboard_survey/dashboard_survey/objects', auth='public')
|
||||
# def list(self, **kw):
|
||||
# return http.request.render('dashboard_survey.listing', {
|
||||
# 'root': '/dashboard_survey/dashboard_survey',
|
||||
# 'objects': http.request.env['dashboard_survey.dashboard_survey'].search([]),
|
||||
# })
|
||||
|
||||
# @http.route('/dashboard_survey/dashboard_survey/objects/<model("dashboard_survey.dashboard_survey"):obj>', auth='public')
|
||||
# def object(self, obj, **kw):
|
||||
# return http.request.render('dashboard_survey.object', {
|
||||
# 'object': obj
|
||||
# })
|
||||
|
||||
@@ -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