diff --git a/bemade_sports_clinic/__manifest__.py b/bemade_sports_clinic/__manifest__.py index 84cb080..540fb08 100644 --- a/bemade_sports_clinic/__manifest__.py +++ b/bemade_sports_clinic/__manifest__.py @@ -25,13 +25,13 @@ 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). - + 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. - + 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. + personnel access to limited player data such as estimated return-to-play dates. """, 'category': 'Services/Medical', 'author': 'Bemade Inc.', diff --git a/bemade_sports_clinic/models/patient.py b/bemade_sports_clinic/models/patient.py index 210cf8e..bc32591 100644 --- a/bemade_sports_clinic/models/patient.py +++ b/bemade_sports_clinic/models/patient.py @@ -11,6 +11,7 @@ class Patient(models.Model): first_name = fields.Char(required=True) last_name = fields.Char(required=True) + name = fields.Char(compute="_compute_name") date_of_birth = fields.Date( groups="bemade_sports_clinic.group_sports_clinic_treatment_professional") age = fields.Integer(compute='_compute_age', @@ -62,9 +63,14 @@ class Patient(models.Model): lambda r: r.predicted_return_date > date.today()).sorted( 'predicted_return_date') if ongoing_injuries: - rec.predicted_return_date = ongoing_injuries[-1] + rec.predicted_return_date = ongoing_injuries[-1].\ + predicted_return_date else: rec.predicted_return_date = False + def _compute_name(self): + for rec in self: + rec.name = ((rec.first_name or "") + " " + (rec.last_name or + "")).strip() class PatientContact(models.Model): @@ -87,7 +93,10 @@ class PatientInjury(models.Model): _description = "A patient's injury." _inherit = ['mail.thread', 'mail.activity.mixin'] - patient_id = fields.Many2one(comodel_name='sports.patient', string="Patient") + patient_id = fields.Many2one(comodel_name='sports.patient', + string="Patient", + readonly=True) + patient_name = fields.Char(related="patient_id.name") diagnosis = fields.Char(tracking=True) injury_date_time = fields.Datetime(string='Date and Time of Injury') internal_notes = fields.Html(tracking=True) diff --git a/bemade_sports_clinic/security/sports_clinic_rules.xml b/bemade_sports_clinic/security/sports_clinic_rules.xml index 2826e13..7920433 100644 --- a/bemade_sports_clinic/security/sports_clinic_rules.xml +++ b/bemade_sports_clinic/security/sports_clinic_rules.xml @@ -16,8 +16,9 @@ - [('message_follower_ids', 'in', user.partner_id.ids)] + [('message_partner_ids', 'in', user.partner_id.ids)] + diff --git a/bemade_sports_clinic/views/patient_views.xml b/bemade_sports_clinic/views/patient_views.xml index 9293c22..0a7f64a 100644 --- a/bemade_sports_clinic/views/patient_views.xml +++ b/bemade_sports_clinic/views/patient_views.xml @@ -63,5 +63,28 @@ + + sports.patient.injury.view.form + sports.patient.injury + +
+
+ +
+

+ +

+
+ + + + + + + +
+
+
+
- \ No newline at end of file +