diff --git a/dental/controller/dental_controller.py b/dental/controller/dental_controller.py index 93a2f2f052..27c01f6cdc 100644 --- a/dental/controller/dental_controller.py +++ b/dental/controller/dental_controller.py @@ -3,7 +3,7 @@ class DentalController(http.Controller): - + # show dental on my account @http.route( [ "/dental", @@ -44,6 +44,7 @@ def show_all_the_data(self, page=1, **kwargs): }, ) + # show all patient @http.route( ["/patient/"], type="http", @@ -59,6 +60,65 @@ def show_patient_details(self, record_id, **kwargs): }, ) + # show personal detail + @http.route( + ["/personal/detail/"], + type="http", + auth="public", + website=True, + ) + def show_personal_detail(self, record_id, **kwargs): + data = request.env["dental.patients"].sudo().browse(record_id) + return request.render( + "dental.personal_detail_template", + { + "personal": data, + }, + ) + + # show medical Aid detail + @http.route( + ["/patients/medical_aid/detail/"], + type="http", + auth="public", + website=True, + ) + def show_medical_aid_detail(self, record_id, **kwargs): + data = request.env["dental.patients"].sudo().browse(record_id) + medical_aid_id = data.medical_aid_id.id + medical_aid = ( + request.env["medical.aids"] + .sudo() + .search( + [ + ("id", "=", medical_aid_id), + ], + ) + ) + return request.render( + "dental.medical_aid_detail_template", + { + "medical_aid": medical_aid, + "patient": data, + }, + ) + + # medical history + @http.route( + ["/medical/history/"], + type="http", + auth="public", + website=True, + ) + def show_medical_history(self, patient_id, **kwargs): + data = request.env["dental.patients"].sudo().browse(patient_id) + history_id = data.history_id + return request.render( + "dental.portal_medical_history_template", + {"history": history_id, "patient": data}, + ) + + # dental history @http.route( ["/dental/history/"], type="http", @@ -67,9 +127,29 @@ def show_patient_details(self, record_id, **kwargs): ) def show_dental_history(self, patient_id, **kwargs): data = request.env["dental.patients"].sudo().browse(patient_id) + history_id = data.history_id return request.render( "dental.dental_history_view", { - "patients": data, + "history": history_id, + "patient": data, + }, + ) + + # Dental_history_detail + @http.route( + ["/history/detail//"], + type="http", + auth="public", + website=True, + ) + def show_dental_history_detail(self, history_id, patient_id, **kwargs): + patient = request.env["dental.patients"].sudo().browse(patient_id) + data = request.env["pateint.history"].sudo().browse(history_id) + return request.render( + "dental.dental_history_detail_view", + { + "history": data, + "patient": patient, }, ) diff --git a/dental/models/medical_aids.py b/dental/models/medical_aids.py index fffad927b3..68f3dcde71 100644 --- a/dental/models/medical_aids.py +++ b/dental/models/medical_aids.py @@ -27,4 +27,3 @@ class MedicalAidsModel(models.Model): tracking=True, default="new", ) - pateint_id = fields.One2many("dental.patients", "medical_aid_id") diff --git a/dental/static/icons/dental.png b/dental/static/icons/dental.png new file mode 100644 index 0000000000..6f1a8342cd Binary files /dev/null and b/dental/static/icons/dental.png differ diff --git a/dental/views/dental_controller.xml b/dental/views/dental_controller.xml index af44946d06..48a74906ce 100644 --- a/dental/views/dental_controller.xml +++ b/dental/views/dental_controller.xml @@ -1,18 +1,29 @@ - + + - -