Added Add Player functionality to portal access for therapists and coaches.

This commit is contained in:
Denis Durepos 2025-06-22 11:32:53 -04:00
parent c60ffd5bfa
commit 1f91c27a44
4 changed files with 134 additions and 16 deletions

View file

@ -21,22 +21,50 @@
'version': '18.0.1.6.2',
'summary': 'Manage the patients of a sports medicine clinic.',
'description': """
Adds the notion of sports teams, players (patients), coaches and treatment
professionals. The core purpose of this module is to keep track of the treatment
history of players and to make it appropriately accessible to the various
involved parties (medical practitioners, clinic staff, team staff, and patients).
Sports Clinic Management System
=============================
Internal users get access to patient data as appropriate, i.e.
treatment professionals get full access to their own patients' data, clinic
staff users get access to basic patient data needed for contacting patients, etc.
A comprehensive solution for managing sports medicine clinics, focusing on player health,
injury tracking, and team collaboration.
External users (portal users) can be added to give coaches and other team
personnel access to limited player data such as estimated return-to-play dates.
Medical professionals (primarily field therapists) can also access the system
via the portal interface instead of requiring full internal user accounts, allowing
for more flexible collaboration while maintaining appropriate access controls.
Coaches and treatment professionals can signal player injuries directly through the
portal interface, streamlining communication and injury tracking.
Key Features:
------------
1. User Roles and Access:
- Internal clinic staff with full patient record access
- Treatment professionals with medical record access
- Portal access for field therapists and team coaches
2. Player Management:
- Track player details and contact information
- Monitor team memberships and playing status
- Record and track injuries and treatment history
- Track match and practice availability
3. Injury Tracking:
- Comprehensive injury recording and documentation
- Treatment professional assignment
- Progress tracking and resolution monitoring
- Internal and external notes for different audiences
4. Team Management:
- Organize players into teams
- Assign coaching and medical staff
- Team-specific player status tracking
5. Portal Access:
- Coaches can view their teams and player status
- Field therapists can access and update medical records
- Injury reporting directly through the portal
6. Security and Privacy:
- Granular permission system
- Field-level security for sensitive information
- Audit trails for all changes
This module is designed to facilitate communication between medical professionals,
coaching staff, and administrative personnel while maintaining appropriate access
controls and data privacy.
""",
"category": "Services/Medical",
"author": "Bemade Inc.",

View file

@ -1,2 +1,3 @@
from . import team_staff_portal
from . import patient_injury_portal
from . import team_management_portal

View file

@ -27,6 +27,11 @@ class Patient(models.Model):
_description = "Patient"
_inherit = ["mail.thread", "mail.activity.mixin"]
_order = "last_name, first_name"
active = fields.Boolean(
string='Active',
default=True,
help="If unchecked, it means this patient has been archived and won't appear in searches by default.")
# res.partner fields
partner_id = fields.Many2one(

View file

@ -47,7 +47,12 @@
</template>
<template id="portal_my_team_players">
<t t-call="portal.portal_layout">
<h1><span t-field="team.name"/> Players</h1>
<div class="d-flex justify-content-between align-items-center mb-3">
<h1 class="mb-0"><span t-field="team.name"/> Players</h1>
<a t-attf-href="/my/team/{{ team.id }}/add_player" class="btn btn-primary">
<i class="fa fa-plus me-1"/> Add Player
</a>
</div>
<t t-call="portal.portal_table">
<thead>
<tr>
@ -58,6 +63,7 @@
<th>Practice Status</th>
<th>Estimated Return Date</th>
<th>Last Consultation Date</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@ -91,6 +97,12 @@
<span t-field="player.last_consultation_date"
t-options="{'widget': 'date'}"/>
</td>
<td class="text-center">
<a t-attf-href="/my/patient/injury/new?patient_id={{ player.id }}&amp;team_id={{ team.id }}"
class="btn btn-primary btn-sm">
<i class="fa fa-plus"/> Report Injury
</a>
</td>
</tr>
</t>
</tbody>
@ -216,5 +228,77 @@
</t>
</xpath>
</template>
<!-- Add Player Form -->
<template id="portal_add_player">
<t t-call="portal.portal_layout">
<div class="container">
<div class="row">
<div class="col-md-8 offset-md-2">
<div class="card">
<div class="card-header">
<h3 class="card-title">Add New Player to <span t-field="team.name"/></h3>
</div>
<div class="card-body">
<!-- Success/Error Messages -->
<t t-if="error" class="alert alert-danger" role="alert">
<i class="fa fa-exclamation-triangle me-2"/>
<span t-esc="error"/>
</t>
<t t-if="success" class="alert alert-success" role="alert">
<i class="fa fa-check-circle me-2"/>
<span t-esc="success"/>
</t>
<form t-attf-action="/my/team/{{ team.id }}/add_player/submit" method="post" class="mt-3">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
<input type="hidden" name="team_id" t-att-value="team.id"/>
<div class="mb-3">
<label for="first_name" class="form-label">First Name *</label>
<input type="text" class="form-control" id="first_name" name="first_name"
t-att-value="first_name or ''" required="required"/>
</div>
<div class="mb-3">
<label for="last_name" class="form-label">Last Name *</label>
<input type="text" class="form-control" id="last_name" name="last_name"
t-att-value="last_name or ''" required="required"/>
</div>
<div class="mb-3">
<label for="email" class="form-label">Email</label>
<input type="email" class="form-control" id="email" name="email"
t-att-value="email or ''"/>
</div>
<div class="mb-3">
<label for="phone" class="form-label">Phone</label>
<input type="tel" class="form-control" id="phone" name="phone"
t-att-value="phone or ''"/>
</div>
<div class="mb-3">
<label for="date_of_birth" class="form-label">Date of Birth</label>
<input type="date" class="form-control" id="date_of_birth" name="date_of_birth"
t-att-value="date_of_birth or ''"/>
</div>
<div class="d-flex justify-content-between">
<a t-attf-href="/my/team?team_id={{ team.id }}" class="btn btn-secondary">
<i class="fa fa-times me-1"/> Cancel
</a>
<button type="submit" class="btn btn-primary">
<i class="fa fa-save me-1"/> Save Player
</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</t>
</template>
</data>
</odoo>
</odoo>