EMS

Erasmus+ document records

EMS is where the Erasmus team manages every document of a project day to day; the centre’s Google Drive is where closed records are archived. There is no separate document manager: the records are a view, organised in categories, of the documents EMS already holds (the call’s documents uploaded by each participant, the group mobilities’ documents, the project’s own documents, invoices and transfer receipts), and an export that builds a verifiable ZIP from them.

Code: models/erasmus/records.py (categories and file checks), models/erasmus/export.py (ems.erasmus.export), the record fields on ems.erasmus.application.document, ems.erasmus.mobility and ems.erasmus.project, and the route /ems/erasmus/export/<id> (controllers/erasmus_export.py).

Three levels

graph TD
    P[ems.erasmus.project<br/>5 categories] -->|mobility_ids| M[ems.erasmus.mobility]
    P -->|document_ids| PD[ems.erasmus.project.document<br/>category, confidential]
    PD -.->|mobility_ids, shared, never copied| M
    M -->|_ems_record_lines| L[ems.erasmus.application.document<br/>file_category, file_state]
    L -->|call_document_id| CD[ems.erasmus.call.document<br/>the requirements matrix]
    P -->|export_ids| X[ems.erasmus.export<br/>the log of each ZIP]
    M -.-> X
Level Categories (code = folder in the ZIP)
Project 01_Projecte, 02_Mobilitats, 03_Economia, 04_Impacte_i_difusio, 05_Informe_final_i_auditoria (PROJECT_CATEGORIES)
Mobility Inside 02_Mobilitats: 00_Documentacio_comuna (project documents in category 02, shared by several participants), one folder per individual participant’s record, and one folder per group mobility (GRUP<id>_<name>, below)
Participant 01_Dades_i_autoritzacions, 02_Abans_de_la_mobilitat, 03_Durant_la_mobilitat, 04_Despres_de_la_mobilitat (PARTICIPANT_CATEGORIES)

The categories replaced the 13 SEPIE folders the project dossier used before (decided by the Erasmus coordinator, 2026-10-24). A database that still has the old sepie_folder column (only development copies: it was never released) gets the category from it on upgrade, EmsErasmusCallDocument._auto_init running records.LEGACY_FOLDER_SQL before Odoo drops the column: health card, inclusion and minors’ authorisations to 01 (the health card confidential), travel to 03, the rest empty (their stage decides). The lines’ stored file_category and confidential are recomputed (record rules and exports read them there); files are not touched.

The call’s documents stay the only list of requirements

What a participant must hand in is still decided only by the call’s documents (ems.erasmus.call.document: requirement, project, modality_ids, signers, handled_by) and the mobility’s conditions (is_minor, placement_type, is_short_blended). The records add no checklist of their own:

A participant’s record for a mobility (_ems_record_lines()) is the application’s own documents (stage application) plus the mobility’s: never another mobility’s, even of the same person. record_missing counts the required lines not complete, record_progress shows “complete / required” (as record_done / record_total, the progress bar of the form and the portal, issue #784), and record_overdue the required lines not complete past their deadline (the only case shown in red); the project sums them (record_count, record_complete_count, record_missing_count).

Project documents (ems.erasmus.project.document) hold what no call document does: the grant agreement with SEPIE, budget follow-up, dissemination, the final report… in a project category. Linked to some mobilities (mobility_ids, constrained to the same project) they appear in those records too, in participant_category, as one file shared by all of them: this is how a document common to several participants (a group programme) or a one-off document about one participant (an incident) enters a record. confidential marks health, inclusion or bank data.

History kept

Keeping period

ems.erasmus.project.keep_until = final_payment_date (when SEPIE paid the balance) + 3 years, or 5 when budget > 60,000 €; empty until both are known. retention_hold + retention_note mark an audit or request still open. Nothing is ever deleted automatically.

keep_until is stored, so the daily cron ems.ir_cron_erasmus_retention_notice (_cron_retention_notice, audit D-12) filters in its domain: every project past its date, without retention_hold and not told yet gets a to-do for the Erasmus coordinators (_ems_coordinators(); the project inherits ems.base for its chatter and activities) and its retention_notice_date. Once per project: changing final_payment_date or budget clears the date, so a new keeping date is told again when it comes. The coordination decides what to keep or delete; there is no automatic archive to Drive.

Export

sequenceDiagram
    actor U as Erasmus team / Secretary
    participant F as Project or mobility form
    participant X as ems.erasmus.export
    participant C as /ems/erasmus/export/<id>
    U->>F: Download the project archive (ZIP) / Export the record
    F->>X: dialog (_ems_open_wizard)
    U->>X: Download the ZIP (create, action_generate)
    X->>C: act_url
    C->>X: _ems_zip(): check, entries, stream files, index, log
    C-->>U: ZIP (streamed, never stored)

Who exports

  Erasmus team Erasmus coordinator Secretary Administrator Others
Export a project or a record yes yes yes yes no (AccessError)
Audit export (with confidential documents, a reason required) no yes no yes no
See the exports log all all own all no

Each export is a log line (ems.erasmus.export: requester, date, scope, audit flag, reason, files, documents missing, SHA-256 of the ZIP), created only as oneself (create and read rights, no write or unlink). The ZIP is downloaded once, by its requester; a record export is also posted in the mobility’s chatter. Without an audit export, confidential documents (call documents with confidential, e.g. the health card and the inclusion documentation; confidential project documents) never leave EMS: a required one appears in the index without its file.

Group mobilities in the export

_ems_group_entries() builds the same layout for scope = group (at the ZIP’s root) and inside a project export:

GRUP<id>_<name>/
├── 00_Documentacio_comuna/            the group's own documents, written once
│   ├── 01_Dades_i_autoritzacions/     shared lines (e.g. group inclusion documentation), Selection.csv, Draws.csv
│   ├── 02_Abans_de_la_mobilitat/      group learning agreement, final list, agreements with the host
│   ├── 03_Durant_la_mobilitat/        group travel documents, common evidence, Follow-up/ (files) and Follow-up.csv
│   └── 04_Despres_de_la_mobilitat/    EU Survey/ (its evidence)
├── ALU<participant id>_<name>/        each selected student: their own lines and the commitment letter
└── PROF<participant id>_<name>/       the leader and the accompanying teachers: their own lines

Commitment letter versions

The letter (ems.erasmus.commitment, shared by internships and group mobilities) keeps every accepted version. A group mobility’s write() compares what the letter states (COMMITMENT_TERMS: city, country, host, dates, travel dates, teachers, additional conditions) before and after; when it changed and a participant had accepted, _ems_commitment_supersede() stores the acceptance as an ems.erasmus.commitment.version (the exact text, who, when, IP for the participant and the family, whether it was provisional, when and why it was replaced; create-only, write/unlink refuse) and clears the signatures, so the new letter is accepted again (the family is emailed again). An acceptance while the destination or the start date is still to be confirmed (_ems_commitment_is_final() false) is commitment_provisional: shown as such and the participant is not ready to leave. Internships never call it (their letter is the call’s annex, fixed once published), so they behave as before. Versions are read by the Erasmus team and the administrator only.

Signatures

Who signs each document and how the signature reaches EMS. A document whose call document has a signature template is signed electronically in EMS (see “Electronic signature” below); without one it is signed outside EMS and uploaded, as in this table:

Document Who signs How it reaches EMS
Commitment letter (internships and group students) participant; family of a minor Accepted on the portal: logged-in user, date, IP, exact text, versions
Grant agreement participant, Director; family of a minor Team uploads it filled in, participant uploads it signed (team_to_sign)
Learning / mobility agreement (individual) participant, coordinator, host; family of a minor Same, team_to_sign or participant
Group learning agreement coordinator, host Team uploads it signed
sBID agreement and activity plan (REF5, REF6) Director or centre’s tutor, participant, host Team uploads them from sBID
Europass mobility document coordinator Team uploads it
Certificate of stay host Participant (or team) uploads it
Report with evidence participant Participant uploads it
Authorisation for minors to travel abroad Mossos d’Esquadra procedure Participant uploads it; never replaced by the commitment letter

Electronic signature (sign_oca)

models/erasmus/electronic_signature.py, on top of OCA’s sign_oca (repository OCA/sign, branch 18.0, a dependency of EMS, listed in scripts/oca_repos.sh: install.sh and update.sh clone it next to queue and partner-contact and add it to the addons_path of odoo.conf). It is a simple electronic signature (the signer draws or types it on a page reached by a personal link), with sign_oca’s log of each step (date, IP, hash of the PDF after each signature), not a qualified one with a certificate.

sequenceDiagram
    participant Team as Erasmus team
    participant Line as Document line
    participant Req as sign.oca.request
    participant S as Signers (participant, family, Director, coordinator, host)
    Team->>Line: uploads the filled-in PDF
    Team->>Line: Send to sign
    Line->>Req: draft: the PDF + the template's boxes of whoever still signs
    Team->>Req: checks the boxes (Configure), Send
    Req->>S: email with a personal link (no EMS account needed)
    S->>Req: signs
    Req->>Line: ticks that signer's signature (sign_signer_id)
    Req->>Line: last signature: the signed PDF becomes a file of the line (to review)
    Team->>Line: Valid

Prepared for later