diff --git a/bemade_sports_clinic/controllers/player_management_portal.py b/bemade_sports_clinic/controllers/player_management_portal.py index 3e702c8..052ed38 100644 --- a/bemade_sports_clinic/controllers/player_management_portal.py +++ b/bemade_sports_clinic/controllers/player_management_portal.py @@ -183,7 +183,7 @@ class PlayerManagementPortal(CustomerPortal): 'patient': patient, 'return_url': return_url, 'page_name': 'add_contact', - 'relationship_types': request.env['sports.patient.contact']._fields['relationship'].selection, + 'relationship_types': request.env['sports.patient.contact']._fields['contact_type'].selection, } return request.render('bemade_sports_clinic.portal_add_contact', values) @@ -209,13 +209,13 @@ class PlayerManagementPortal(CustomerPortal): return request.redirect(f'/my/player?player_id={patient_id}') # Required fields - if not post.get('name') or not post.get('relationship'): + if not post.get('name') or not post.get('contact_type'): values = { 'patient': patient, - 'error': _("Name and relationship are required fields"), + 'error': _("Name and contact type are required fields"), 'return_url': f'/my/player?player_id={patient_id}', 'page_name': 'add_contact', - 'relationship_types': request.env['sports.patient.contact']._fields['relationship'].selection, + 'relationship_types': request.env['sports.patient.contact']._fields['contact_type'].selection, } values.update(post) return request.render('bemade_sports_clinic.portal_add_contact', values) @@ -224,18 +224,12 @@ class PlayerManagementPortal(CustomerPortal): vals = { 'patient_id': int(patient_id), 'name': post.get('name'), - 'relationship': post.get('relationship'), + 'contact_type': post.get('contact_type'), } # Optional fields - if post.get('phone'): - vals['phone'] = post.get('phone') - - if post.get('email'): - vals['email'] = post.get('email') - - if post.get('notes'): - vals['notes'] = post.get('notes') + if post.get('mobile'): + vals['mobile'] = post.get('mobile') # Create the contact request.env['sports.patient.contact'].sudo().create(vals) @@ -269,7 +263,7 @@ class PlayerManagementPortal(CustomerPortal): 'contact': contact, 'return_url': return_url, 'page_name': 'edit_contact', - 'relationship_types': request.env['sports.patient.contact']._fields['relationship'].selection, + 'relationship_types': request.env['sports.patient.contact']._fields['contact_type'].selection, } return request.render('bemade_sports_clinic.portal_edit_contact', values) @@ -300,14 +294,14 @@ class PlayerManagementPortal(CustomerPortal): return request.redirect(f'/my/player?player_id={patient.id}') # Required fields - if not post.get('name') or not post.get('relationship'): + if not post.get('name') or not post.get('contact_type'): values = { 'patient': patient, 'contact': contact, - 'error': _("Name and relationship are required fields"), + 'error': _("Name and contact type are required fields"), 'return_url': f'/my/player?player_id={patient.id}', 'page_name': 'edit_contact', - 'relationship_types': request.env['sports.patient.contact']._fields['relationship'].selection, + 'relationship_types': request.env['sports.patient.contact']._fields['contact_type'].selection, } values.update(post) return request.render('bemade_sports_clinic.portal_edit_contact', values) @@ -315,24 +309,14 @@ class PlayerManagementPortal(CustomerPortal): # Prepare values for contact update vals = { 'name': post.get('name'), - 'relationship': post.get('relationship'), + 'contact_type': post.get('contact_type'), } # Optional fields - if post.get('phone'): - vals['phone'] = post.get('phone') + if post.get('mobile'): + vals['mobile'] = post.get('mobile') else: - vals['phone'] = False - - if post.get('email'): - vals['email'] = post.get('email') - else: - vals['email'] = False - - if post.get('notes'): - vals['notes'] = post.get('notes') - else: - vals['notes'] = False + vals['mobile'] = False # Update the contact contact.sudo().write(vals) diff --git a/bemade_sports_clinic/security/ir.model.access.csv b/bemade_sports_clinic/security/ir.model.access.csv index a355ba4..b24fe34 100644 --- a/bemade_sports_clinic/security/ir.model.access.csv +++ b/bemade_sports_clinic/security/ir.model.access.csv @@ -36,6 +36,6 @@ access_mail_notification_portal_tp,Portal TP Access for Mail Notifications,mail. access_ir_attachment_portal_tp,Portal TP Access for Attachments,base.model_ir_attachment,bemade_sports_clinic.group_portal_treatment_professional,1,1,1,0 access_res_users_portal_tp,Portal TP Access for Users,base.model_res_users,bemade_sports_clinic.group_portal_treatment_professional,1,0,0,0 -access_res_partner_portal_tp,Portal TP Access for Partners,base.model_res_partner,bemade_sports_clinic.group_portal_treatment_professional,1,0,0,0 +access_res_partner_portal_tp,Portal TP Access for Partners,base.model_res_partner,bemade_sports_clinic.group_portal_treatment_professional,1,1,1,0 access_mail_followers_portal_tp,Portal TP Access for Followers,mail.model_mail_followers,bemade_sports_clinic.group_portal_treatment_professional,1,1,1,0 access_bus_bus_portal_tp,Portal TP Access for Bus Messages,bus.model_bus_bus,bemade_sports_clinic.group_portal_treatment_professional,1,1,1,0 diff --git a/bemade_sports_clinic/views/player_management_portal_templates.xml b/bemade_sports_clinic/views/player_management_portal_templates.xml index 339bb4c..2a49d43 100644 --- a/bemade_sports_clinic/views/player_management_portal_templates.xml +++ b/bemade_sports_clinic/views/player_management_portal_templates.xml @@ -168,11 +168,11 @@
- - - @@ -198,15 +198,7 @@
-
-
-
- -