first push message

This commit is contained in:
2026-07-01 14:41:49 +07:00
parent 6667dec2bf
commit 58b5f46cc4
2951 changed files with 316619 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
from . import main
@@ -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
# })
+24
View File
@@ -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)