EMS

Portal profile (/my/account)

The stock Odoo profile page lets a portal user edit their own name, email, address and VAT. EMS replaces it, for every portal user (students and families), with a read-only page. It shows the student’s school data, the account’s own contact details and the status of the contact data review (issue #507, issue #736). Internal users keep the stock editable form.

Piece Role
controllers/portal_account.py (EMSPortalAccount.account) Never processes a POST from a portal user (the stock controller writes the partner with sudo(), so hiding the inputs would not be enough), renders portal.portal_my_details with ems_profile_readonly and the values of _ems_profile_values()
views/portal/portal_account_readonly.xml portal_my_details_readonly: hides the stock form and renders the three blocks; portal_profile_value: one label/value pair, a dash when empty
res.partner._ems_contact_data_running_request() The student’s ems.contact.data.request of the running academic year, shared with /my/dades-contacte and the home banner (_ems_contact_data_requested())

What each account sees

flowchart TD
    A[Portal user opens /my/account] --> B{get_portal_student is a student or applicant?}
    B -- yes --> C[School details block: photo, name, IDALU, birth date, group, study, tutor and email, corporate email]
    B -- no: family with no child to see --> D
    C --> D[Own contact details block]
    D --> E{_ems_portal_contact_data_student?}
    E -- yes --> F[Review status + Update contact details button]
    E -- no, own student account: minor --> G[Your family can ask to change these details]
    E -- no, otherwise --> H[Contact the secretary's office]
    D --> I{Account is the student?}
    I -- yes --> J[Family block: name, relation, mobile, email]

Everything is read with sudo(): a portal user has no rights on the relations, the groups or the tutor’s hr.employee. The data read is limited to the account itself and the student get_portal_student() already authorizes.

Tests

tests/test_portal_profile.py (TestPortalProfile): what a minor student, their family and an adult student see, and the three review statuses. The render tour ems_portal_account_render (TestPortalTour) and the contact data tour (TestContactDataRequestTour, which starts from the profile button) cover the browser side.