EMS

Technical Reference: res.config.settings (EMS extension)

Overview

models/settings/settings.py extends Odoo’s res.config.settings transient wizard with a related=..., readonly=False field for every EMS-added res.company field (see res.company for what each one does) — this is what makes them editable from the Settings screen at all. It is a thin proxy: reading/writing any of these fields just reads/writes the underlying res.company field through the relation.

Module file: models/settings/settings.py

The only behaviour that isn’t a plain passthrough is set_values(), plus the About block’s installed/latest version check.


set_values() — EMS auto-checkout cron activation

flowchart TD
    A([Admin saves Settings]) --> B[super.set_values writes every related field to res.company]
    B --> C{auto_checkout_mode == 'ems'?}
    C -- No --> D[Nothing else happens]
    C -- Yes --> E{hr_attendance_check_out_cron exists?}
    E -- No --> D
    E -- Yes --> F[Activate the cron: active=True, every 1 hour]
    F --> G[nextcall = next occurrence of auto_checkout_time,<br/>computed via ems.datetime_utils.next_occurrence_utc]

Switching auto_checkout_mode back to native does not deactivate the cron — set_values() only acts when the mode is 'ems'; the native mode relies on Odoo/hr_attendance’s own built-in auto-checkout instead, which this cron has nothing to do with. Toggling away from 'ems' currently leaves a previously-activated cron running; if that turns out to matter operationally, it’s a one-line follow-up (deactivate the cron in the else branch) — not addressed in this DTON pass since it wasn’t flagged as broken.


About block: installed and latest EMS version

Shown at the bottom of the EMS Management tab.

Field What it holds
ems_version ir.module.module.latest_version for ems (with sudo()): the version the database was last installed/upgraded to, i.e. the one actually running, not the manifest on disk (code pulled but not yet upgraded would show the new number too early).
ems_latest_version, ems_latest_version_url Newest published release on GitHub (tag without the leading v, and its release page). Empty when GitHub could not be read.
ems_version_status, ems_version_message Non-stored computes: latest (installed >= latest, which also covers a development branch already carrying the next version), outdated (message links the release) or unknown.
flowchart TD
    A([Admin opens Settings]) --> B[onchange → default_get]
    B --> C[_fetch_latest_ems_release, 2 s timeout]
    C -- release --> D{installed >= latest?}
    D -- Yes --> E[You are on the latest version]
    D -- No --> F[A newer version is available: link]
    C -- timeout / error --> G[Could not be checked + Check again button]
    G --> H[Reopens ems.action_settings with<br/>ems_check_version_again in the context]
    H --> I[_fetch_latest_ems_release, 10 s timeout] --> D

Notes:


Access Control

Same as any res.config.settings: reaching the screen at all requires Settings access (standard Odoo base.group_system-gated navigation), not an EMS-specific rule.


Views

View File Notes
Settings form views/settings/form.xml See res.company’s Views section — same page, already covered by the ems_course_settings tour; the ems_settings_edit tour also checks the About block’s version