Moodle Attendance Sync
Attendance records from Moodle's Attendance plugin map to OEC's attendance registers and session lines. Unlike grade sync (pull-only) or course sync (push-only), attendance direction is configurable: pull from Moodle, push from OEC, or run bidirectionally.
The sync requires the local_wsattendance Moodle plugin, which exposes the attendance WS API. The integration detects its presence at runtime and gracefully skips attendance sync if the plugin is not installed.
Attendance Status Mapping
Moodle uses single-character acronyms. OEC uses four boolean fields. The mapping is fixed.
Present
Moodle acronym: P
present=True
All other booleans → False
Absent
Moodle acronym: A
absent=True
All other booleans → False
Late
Moodle acronym: L
late=True
All other booleans → False
Excused
Moodle acronym: E
excused=True
All other booleans → False
Custom Moodle status acronyms beyond P, A, L, E are skipped by the integration.
Sync Direction Options
Set sync_attendance_from on the Moodle Instance record in Odoo.
moodlePull from Moodle (default)
Moodle Attendance plugin is the source of truth. OEC attendance registers are populated from Moodle sessions.
Best for
Online-first institutions where all sessions are tracked in Moodle.
oecPush from OEC
OEC is the source of truth. Attendance marked in OEC is pushed to Moodle via mod_wsattendance_update_user_status.
Best for
Institutions that use OEC for in-person attendance and want Moodle to reflect it.
bothBidirectional (last-write wins)
Both systems can record attendance. The most recent write wins. Conflicts are not flagged, the last timestamp takes precedence.
Best for
Hybrid institutions with both in-person (OEC) and online (Moodle) sessions.
Prerequisites
Attendance sync requires additional setup beyond the base Moodle integration.
| Requirement | Where to install | Notes |
|---|---|---|
| Moodle mod_attendance plugin | Moodle plugin directory | Core attendance plugin. Provides the session and attendance status data structures. |
| local_wsattendance plugin | Moodle plugin directory (additional install) | Exposes mod_wsattendance_get_session and mod_wsattendance_update_user_status WS functions. Required for any API access to attendance data. |
| openeducat_attendance module | OEC module list | The OEC attendance module must be installed. Provides op.attendance.register, op.attendance.sheet, op.attendance.line models. |
| WS function enabled on external service | Moodle → Site Administration → Web services → External services | Add mod_wsattendance_get_session (and mod_wsattendance_update_user_status for push direction) to the openeducat_integration service. |
OEC Attendance Data Structure
Moodle attendance sessions map to a three-level hierarchy in OEC.
op.attendance.registerOne per session date + subject
Created or found by the sync service. Note: this model does NOT have a faculty_id field. Faculty is on op.attendance.sheet, not the register.
op.attendance.sheetGroups students for a register
Created per batch within a register. The faculty_id field lives here, but the sync service does not set it, there is no reliable mapping from a Moodle session to an OEC faculty member.
op.attendance.lineOne row per student per session
The four boolean fields (present, absent, late, excused) are set from the Moodle status acronym mapping. Lines are idempotent, existing lines are updated on subsequent syncs.
Runtime prerequisite check
The SyncAttendance._check_prerequisites() method runs before every sync. It calls module_detector.detect_installed_modules() to verify both mod_attendance and local_wsattendance are present in Moodle. If either is missing, attendance sync is skipped gracefully, it does not raise an error or block other sync services.
Attendance Sync, Frequently Asked Questions
How Moodle attendance sessions map to OEC attendance records.
Ready to Transform Your Attendance Sync?
See how OpenEduCat frees up time so every student gets the attention they deserve.
Try it free for 15 days. No credit card required.