diff --git a/bemade_sports_clinic/models/patient.py b/bemade_sports_clinic/models/patient.py index bc32591..7df7a93 100644 --- a/bemade_sports_clinic/models/patient.py +++ b/bemade_sports_clinic/models/patient.py @@ -106,5 +106,5 @@ class PatientInjury(models.Model): column2='treatment_pro_id', string='Treatment Professionals', domain=[ - ('type', '=', 'treatment_pro')], ) + ('user_ids', '!=', False)], ) predicted_return_date = fields.Date(tracking=True) diff --git a/bemade_sports_clinic/models/res_partner.py b/bemade_sports_clinic/models/res_partner.py index 6549207..3b7d5f5 100644 --- a/bemade_sports_clinic/models/res_partner.py +++ b/bemade_sports_clinic/models/res_partner.py @@ -10,9 +10,7 @@ class Partner(models.Model): column1='team_id', column2='patient_id', string='Players') - type = fields.Selection(selection_add=[('team', 'Sports Team'), - ('treatment_pro', 'Treatment Professional'), - ]) + type = fields.Selection(selection_add=[('team', 'Sports Team'),]) staff_partner_ids = fields.Many2many(comodel_name='res.partner', relation='sports_team_staff_partner_rel', column1='team_id', @@ -25,14 +23,6 @@ class Partner(models.Model): string='Teams') def write(self, vals): - # Override to validate changes to the 'type' field - treatment_pros = self.filtered(lambda r: r.type == 'treatment_pro') - if treatment_pros and 'type' in vals and vals['type'] != 'treatment_pro': - injuries = self.env['sports.patient.injury'].search_count( - [('treatment_professional_ids', 'in', treatment_pros.ids)]) - if injuries: - raise UserError(_('Partner type cannot be changed since this treatment ' - 'professional appears on a patient injury record.')) teams = self.filtered(lambda r: r.type == 'team') if teams and 'type' in vals and vals['type'] != 'team': if teams.mapped('staff_partner_ids') or teams.mapped('patient_ids'): @@ -42,13 +32,6 @@ class Partner(models.Model): return super().write(vals) def unlink(self): - treatment_pros = self.filtered(lambda r: r.type == 'treatment_pro') - if treatment_pros: - injuries = self.env['sports.patient.injury'].search_count( - [('treatment_professional_ids', 'in', treatment_pros.ids)]) - if injuries: - raise UserError(_('Treatment professional cannot be deleted since they ' - 'appears on a patient injury record.')) teams = self.filtered(lambda r: r.type == 'team') if teams: if teams.mapped('staff_partner_ids') or teams.mapped('patient_ids'): diff --git a/bemade_sports_clinic/views/patient_views.xml b/bemade_sports_clinic/views/patient_views.xml index 0a7f64a..b237c28 100644 --- a/bemade_sports_clinic/views/patient_views.xml +++ b/bemade_sports_clinic/views/patient_views.xml @@ -86,5 +86,17 @@ + + sports.patient.injury.view.tree + sports.patient.injury + + + + + + + + + diff --git a/bemade_sports_clinic/views/res_partner_views.xml b/bemade_sports_clinic/views/res_partner_views.xml index 85758ad..5d158ee 100644 --- a/bemade_sports_clinic/views/res_partner_views.xml +++ b/bemade_sports_clinic/views/res_partner_views.xml @@ -13,4 +13,4 @@ - \ No newline at end of file + diff --git a/bemade_sports_clinic/views/sports_clinic_menus.xml b/bemade_sports_clinic/views/sports_clinic_menus.xml index 765f2f3..8162657 100644 --- a/bemade_sports_clinic/views/sports_clinic_menus.xml +++ b/bemade_sports_clinic/views/sports_clinic_menus.xml @@ -19,12 +19,6 @@ sports.patient list,kanban,form - - Treatment Professionals - res.partner - [('type', '=', 'treatment_pro')] - list,kanban,form - - - \ No newline at end of file +