From f5e1751da7229de7d40a0669f6f3ee538e618935 Mon Sep 17 00:00:00 2001 From: Denis Durepos Date: Thu, 21 Aug 2025 06:20:07 -0400 Subject: [PATCH] bemade_sports_clinic: - Add 'account' to depends to ensure invoice portal templates are present - Hide invoice cards for coaches/therapists via override of account.portal_my_home_invoice - Events portal: create/edit templates and controller adjustments for therapist workflow - Minor portal home styling and visibility tweaks for clinic roles --- bemade_sports_clinic/__manifest__.py | 1 + bemade_sports_clinic/controllers/events_portal.py | 10 ++++++++-- .../views/portal_event_create_template.xml | 2 +- .../views/portal_event_edit_template.xml | 2 +- .../views/sports_clinic_portal_views.xml | 2 +- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/bemade_sports_clinic/__manifest__.py b/bemade_sports_clinic/__manifest__.py index 77069ab..2a46d91 100644 --- a/bemade_sports_clinic/__manifest__.py +++ b/bemade_sports_clinic/__manifest__.py @@ -49,6 +49,7 @@ This module provides a complete sports medicine clinic management solution with "contacts", "phone_validation", # For phone number formatting in patient contacts "project", # Required for project.task (Events) functionality + "account", # Ensure account portal templates (e.g., portal_my_home_invoice) are available ], "external_dependencies": { "python": [ diff --git a/bemade_sports_clinic/controllers/events_portal.py b/bemade_sports_clinic/controllers/events_portal.py index c0df715..6d37e8e 100644 --- a/bemade_sports_clinic/controllers/events_portal.py +++ b/bemade_sports_clinic/controllers/events_portal.py @@ -526,10 +526,16 @@ class EventsPortal(CustomerPortal, AccessControlMixin): else: raise UserError(_('Event end time is required.')) - if 'therapist_start' in post and post['therapist_start']: + # Default therapist times to event times if not provided + if post.get('therapist_start'): create_vals['therapist_start'] = _parse_dt(post['therapist_start']) - if 'therapist_end' in post and post['therapist_end']: + else: + create_vals['therapist_start'] = create_vals['date_start'] + + if post.get('therapist_end'): create_vals['therapist_end'] = _parse_dt(post['therapist_end']) + else: + create_vals['therapist_end'] = create_vals['date_end'] # Assigned staff (same handling as save_event) staff_param = None diff --git a/bemade_sports_clinic/views/portal_event_create_template.xml b/bemade_sports_clinic/views/portal_event_create_template.xml index d56e2a2..2dbc99c 100644 --- a/bemade_sports_clinic/views/portal_event_create_template.xml +++ b/bemade_sports_clinic/views/portal_event_create_template.xml @@ -453,7 +453,7 @@ var startDt = parseLocal(dateStart.value); if (!startDt) return; if (therapistStart) { - therapistStart.value = formatLocal(addMinutes(startDt, -120)); + therapistStart.value = formatLocal(startDt); } if (dateEnd) { var endDt = addMinutes(startDt, 120); diff --git a/bemade_sports_clinic/views/portal_event_edit_template.xml b/bemade_sports_clinic/views/portal_event_edit_template.xml index 9dd1ac1..490cac3 100644 --- a/bemade_sports_clinic/views/portal_event_edit_template.xml +++ b/bemade_sports_clinic/views/portal_event_edit_template.xml @@ -484,7 +484,7 @@ var startDt = parseLocal(dateStart.value); if (!startDt) return; if (therapistStart) { - therapistStart.value = formatLocal(addMinutes(startDt, -120)); + therapistStart.value = formatLocal(startDt); } if (dateEnd) { var endDt = addMinutes(startDt, 120); diff --git a/bemade_sports_clinic/views/sports_clinic_portal_views.xml b/bemade_sports_clinic/views/sports_clinic_portal_views.xml index 8c9d926..9053c75 100644 --- a/bemade_sports_clinic/views/sports_clinic_portal_views.xml +++ b/bemade_sports_clinic/views/sports_clinic_portal_views.xml @@ -36,7 +36,7 @@ - +