diff --git a/bemade_sports_clinic/controllers/team_staff_portal.py b/bemade_sports_clinic/controllers/team_staff_portal.py index ad225ba..bd2e6b5 100644 --- a/bemade_sports_clinic/controllers/team_staff_portal.py +++ b/bemade_sports_clinic/controllers/team_staff_portal.py @@ -47,14 +47,15 @@ class TeamStaffPortal(CustomerPortal): 'page_name': 'my_teams', }) - @http.route(route=['/my/team/', '/my/team//page/'], type='http', auth='user', website=True) + @http.route(route=['/my/team', '/my/team/page/'], type='http', auth='user', website=True) def view_team(self, team_id, page=0, **kw): """ Display the information for a team including its list of players """ + team_id = int(team_id) team = http.request.env['sports.team'].browse(team_id) if not team: raise UserError(_('This team could not be found.')) players_count = team.player_count - pgr = pager(url=f'/my/team/{team_id}', total=players_count, page=page, step=10, + pgr = pager(url=f'/my/team?team_id={team_id}', total=players_count, page=page, step=10, scope=5) players = http.request.env['sports.patient'].search([ ('team_ids', 'in', team_id), @@ -88,12 +89,14 @@ class TeamStaffPortal(CustomerPortal): 'page_name': 'my_players', }) - @http.route(route=['/my/players/', '/my/players//'], type='http', + @http.route(route=['/my/player'], type='http', auth='user', website=True) def view_player(self, player_id, team_id=None,**kw): """ Display the active injuries for a given player. """ + player_id = int(player_id) + team_id = team_id and int(team_id) player = http.request.env['sports.patient'].browse(player_id) - team = team_id and http.request.env['sports.team'].browse(player_id) + team = team_id and http.request.env['sports.team'].browse(team_id) if not player: raise UserError(_('This player could not be found.')) injuries = player.injury_ids.filtered(lambda r: r.stage == 'active') @@ -102,6 +105,7 @@ class TeamStaffPortal(CustomerPortal): qcontext={ 'player': player, 'injuries': injuries, - 'team': team + 'team': team, + 'page_name': 'my_player', } ) diff --git a/bemade_sports_clinic/migrations/16.0.1.5.0/end-migrate_create_patient_partners.py b/bemade_sports_clinic/migrations/16.0.1.5.0/end-migrate_create_patient_partners.py deleted file mode 100644 index abceaa7..0000000 --- a/bemade_sports_clinic/migrations/16.0.1.5.0/end-migrate_create_patient_partners.py +++ /dev/null @@ -1,11 +0,0 @@ -from odoo import api, SUPERUSER_ID - - -def migrate(cr, version): - env = api.Environment(cr, SUPERUSER_ID, {}) - patients = env['sports.patient'].search([('partner_id', '=', False)]) - for patient in patients: - partner = env['res.partner'].create({ - 'name': patient._get_name_from_first_and_last(patient.first_name, patient.last_name), - 'patient_ids': [(4, patient.id)] - }) \ No newline at end of file diff --git a/bemade_sports_clinic/models/patient.py b/bemade_sports_clinic/models/patient.py index 47c99c2..a15db38 100644 --- a/bemade_sports_clinic/models/patient.py +++ b/bemade_sports_clinic/models/patient.py @@ -232,7 +232,7 @@ class PatientInjury(models.Model): required=True) patient_name = fields.Char(related="patient_id.name") diagnosis = fields.Char(tracking=True) - injury_date = fields.Date(string='Date and Time of Injury', + injury_date = fields.Date(string='Date of Injury', default=date.today()) injury_date_na = fields.Boolean(string="N/A", default=False) internal_notes = fields.Html(tracking=True) diff --git a/bemade_sports_clinic/views/sports_clinic_portal_views.xml b/bemade_sports_clinic/views/sports_clinic_portal_views.xml index 27152b7..a91b59e 100644 --- a/bemade_sports_clinic/views/sports_clinic_portal_views.xml +++ b/bemade_sports_clinic/views/sports_clinic_portal_views.xml @@ -32,7 +32,7 @@ - @@ -63,7 +63,8 @@ - + @@ -115,7 +116,7 @@ - + @@ -129,7 +130,7 @@