-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-Create Controller -Show the the list of patient -Redirect medical aid and personal and medical history to the form view of these
- Loading branch information
Showing
13 changed files
with
299 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import models | ||
from . import controller |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import dental_controller |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
from odoo import http | ||
from odoo.http import request | ||
|
||
|
||
class DentalController(http.Controller): | ||
|
||
@http.route( | ||
[ | ||
"/dental", | ||
], | ||
type="http", | ||
auth="public", | ||
website=True, | ||
) | ||
def show_all_the_data(self, page=1, **kwargs): | ||
user = request.env.user | ||
try: | ||
page = int(page) | ||
except ValueError: | ||
page = 1 | ||
print(user.partner_id.id) | ||
patient = request.env["dental.patients"].sudo() | ||
patient_per_page = 6 | ||
total_patients = patient.search_count( | ||
[ | ||
("guarantor_id", "=", user.partner_id.id), | ||
] | ||
) | ||
total_pages = (total_patients + patient_per_page - 1) // patient_per_page | ||
page = max(1, min(page, total_pages)) | ||
offset = (page - 1) * patient_per_page | ||
patients = patient.search( | ||
[ | ||
("guarantor_id", "=", user.partner_id.id), | ||
], | ||
limit=patient_per_page, | ||
offset=offset, | ||
) | ||
return request.render( | ||
"dental.dental_patient_view_controller", | ||
{ | ||
"patients": patients, | ||
"page": page, | ||
"total_pages": total_pages, | ||
}, | ||
) | ||
|
||
@http.route( | ||
["/patient/<int:record_id>"], | ||
type="http", | ||
auth="public", | ||
website=True, | ||
) | ||
def show_patient_details(self, record_id, **kwargs): | ||
data = request.env["dental.patients"].sudo().browse(record_id) | ||
return request.render( | ||
"dental.patient_details_view_controller", | ||
{ | ||
"patients": data, | ||
}, | ||
) | ||
|
||
@http.route( | ||
["/dental/history/<int:patient_id>"], | ||
type="http", | ||
auth="public", | ||
website=True, | ||
) | ||
def show_dental_history(self, patient_id, **kwargs): | ||
data = request.env["dental.patients"].sudo().browse(patient_id) | ||
print(patient_id) | ||
return request.render( | ||
"dental.dental_history_view", | ||
{ | ||
"patients": data, | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.