diff --git a/addons/mc_education_theme/__manifest__.py b/addons/mc_education_theme/__manifest__.py index 267dd2f..afb766c 100644 --- a/addons/mc_education_theme/__manifest__.py +++ b/addons/mc_education_theme/__manifest__.py @@ -17,6 +17,7 @@ ], "demo": [ "demo/mc_theme_demo.xml", + "demo/mc_cast_users_demo.xml", ], "installable": True, "application": False, diff --git a/addons/mc_education_theme/demo/mc_cast_users_demo.xml b/addons/mc_education_theme/demo/mc_cast_users_demo.xml new file mode 100644 index 0000000..49271f7 --- /dev/null +++ b/addons/mc_education_theme/demo/mc_cast_users_demo.xml @@ -0,0 +1,82 @@ + + + + + Rekha Nair + principal@demo.school + principal@demo.school + demo1234 + + + + + Sunitha R + office@demo.school + office@demo.school + demo1234 + + + + + Arun Prakash + teacher@demo.school + teacher@demo.school + demo1234 + + + + + + + + + + + David Fernandes + accounts@demo.school + accounts@demo.school + demo1234 + + + diff --git a/addons/mc_education_theme/tests/test_theme.py b/addons/mc_education_theme/tests/test_theme.py index f785440..0535b08 100644 --- a/addons/mc_education_theme/tests/test_theme.py +++ b/addons/mc_education_theme/tests/test_theme.py @@ -30,3 +30,37 @@ class TestTheme(TransactionCase): self.assertNotIn("Powered by", html) self.assertNotIn("odoo.com", html) self.assertNotIn("Odoo Logo", html) + + def test_backend_cast_logins_exist_in_the_right_groups(self): + # shared/DEMO_SCRIPT.md's cast table names six logins. Two + # (parent@demo.school, student@demo.school) are created by + # mc_education_portal. The other four were explicitly deferred + # to this module (see demo/mc_cast_users_demo.xml) and, until + # that file existed, were never actually created anywhere - + # the demo script would have stalled at Scene 1 on a clean + # rehearsal. This test is the regression guard for that gap. + principal = self.env["res.users"].search([("login", "=", "principal@demo.school")]) + self.assertTrue(principal) + self.assertIn( + self.env.ref("mc_education_base.group_school_administrator"), principal.group_ids + ) + + office = self.env["res.users"].search([("login", "=", "office@demo.school")]) + self.assertTrue(office) + self.assertIn(self.env.ref("mc_education_base.group_school_staff"), office.group_ids) + + accountant = self.env["res.users"].search([("login", "=", "accounts@demo.school")]) + self.assertTrue(accountant) + self.assertIn(self.env.ref("mc_education_base.group_accountant"), accountant.group_ids) + + teacher = self.env["res.users"].search([("login", "=", "teacher@demo.school")]) + self.assertTrue(teacher) + self.assertIn(self.env.ref("mc_education_base.group_teacher"), teacher.group_ids) + + # Not just "a teacher login exists" - it has to be *the* login + # that Grade 8-A's class_teacher_id points at, because that is + # what mc_education_attendance's record rule actually checks. + arun = self.env.ref("mc_education_base.demo_employee_arun_prakash") + self.assertEqual(arun.user_id, teacher) + grade_8a = self.env.ref("mc_education_base.demo_batch_grade8_a") + self.assertEqual(grade_8a.class_teacher_id, arun)