diff --git a/addons/education_dashboard/controllers/__pycache__/main.cpython-312.pyc b/addons/education_dashboard/controllers/__pycache__/main.cpython-312.pyc index 808b76d..8eea5c9 100644 Binary files a/addons/education_dashboard/controllers/__pycache__/main.cpython-312.pyc and b/addons/education_dashboard/controllers/__pycache__/main.cpython-312.pyc differ diff --git a/addons/education_dashboard/controllers/main.py b/addons/education_dashboard/controllers/main.py index 3177f77..44de914 100644 --- a/addons/education_dashboard/controllers/main.py +++ b/addons/education_dashboard/controllers/main.py @@ -109,6 +109,33 @@ class EducationDashboardController(http.Controller): except Exception: pass + # ── Announcements ───────────────────────────────────────────────────── + announcements_data = [] + try: + announcements = env['education.announcement'].search( + [('active', '=', True)], + order='date_published desc', limit=4 + ) + for ann in announcements: + import re + subtitle = re.sub('<[^>]+>', '', ann.content or '')[:60] + type_colors = { + 'notice': ('#fee2e2', '#b91c1c'), + 'circular': ('#e0f2fe', '#0369a1'), + 'event': ('#fef9c3', '#a16207') + } + bg_color, text_color = type_colors.get(ann.announcement_type, ('#d1fae5', '#065f46')) + ann_type = dict(ann._fields['announcement_type'].selection).get(ann.announcement_type) if ann.announcement_type else 'Notice' + announcements_data.append({ + 'title': ann.title, + 'subtitle': subtitle + ('...' if len(subtitle) == 60 else ''), + 'type': ann_type, + 'bg_color': bg_color, + 'text_color': text_color, + }) + except Exception: + pass + # ── User / date context ─────────────────────────────────────────────── user_name = env.user.name today_str = datetime.date.today().strftime('%A, %b %d, %Y') @@ -149,6 +176,7 @@ class EducationDashboardController(http.Controller): # operational 'upcoming_exams': upcoming_exams, 'recent_activities': recent_activities, + 'announcements': announcements_data, # context 'user_name': user_name, 'today': today_str, diff --git a/addons/education_dashboard/static/src/js/education_dashboard.js b/addons/education_dashboard/static/src/js/education_dashboard.js index 3cce0d8..f26bc7c 100644 --- a/addons/education_dashboard/static/src/js/education_dashboard.js +++ b/addons/education_dashboard/static/src/js/education_dashboard.js @@ -243,7 +243,7 @@ class EducationDashboard extends Component { openCreateCourse() { this.actionService.doAction({ name: "Courses", type: "ir.actions.act_window", - res_model: "education.course", + res_model: "education.lms.course", views: [[false, "list"], [false, "form"]], target: "current" }); } @@ -267,7 +267,7 @@ class EducationDashboard extends Component { openFees() { this.actionService.doAction({ name: "Fee Payments", type: "ir.actions.act_window", - res_model: "education.fee.payment", + res_model: "education.student.payment", views: [[false, "list"], [false, "form"]], target: "current" }); } diff --git a/addons/education_dashboard/static/src/xml/education_dashboard_templates.xml b/addons/education_dashboard/static/src/xml/education_dashboard_templates.xml index 534faa9..7d301f3 100644 --- a/addons/education_dashboard/static/src/xml/education_dashboard_templates.xml +++ b/addons/education_dashboard/static/src/xml/education_dashboard_templates.xml @@ -239,38 +239,24 @@ View All -