Skip to content

Commit

Permalink
[IMP] dental: Added additional feature
Browse files Browse the repository at this point in the history
- Added controller in the module as per given task
   - patient details page
- Designed the overall ui of module
  • Loading branch information
akpu-odoo committed Sep 6, 2024
1 parent e802298 commit d7b5642
Show file tree
Hide file tree
Showing 16 changed files with 352 additions and 25 deletions.
1 change: 1 addition & 0 deletions dental/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import models
from . import controller
3 changes: 2 additions & 1 deletion dental/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
"version": "0.1",
"application": True,
"installable": True,
"depends": ["base", "mail", "account"],
"depends": ["base", "mail", "account", "website"],
"data": [
"security/ir.model.access.csv",
"report/dental_patient_report_view.xml",
"report/dental_patient_report_action.xml",
"views/patient_history_form_tree_view.xml",
"views/dental_controller.xml",
"views/dental_views.xml",
"views/patient_history_views.xml",
"views/dental_menus.xml",
Expand Down
1 change: 1 addition & 0 deletions dental/controller/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import dental_controller
58 changes: 58 additions & 0 deletions dental/controller/dental_controller.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
from odoo import http
from odoo.http import request


class DentalController(http.Controller):

@http.route(
[
"/home/dental",
],
type="http",
auth="public",
website=True,
)
def show_all_the_data(self, **kwargs):
current_user = request.env.user
custom_data = request.env["dental.patient"].search(
[("gurantor", "=", current_user.id)]
)
return request.render(
"dental.dental_card_controller",
{
"patients": custom_data,
},
)

@http.route(
["/home/dental/<int:record_id>"],
type="http",
auth="user",
website=True,
)
def show_patient_details(self, record_id, **kwargs):
custom_data = request.env["dental.patient"].sudo().browse(record_id)

return request.render(
"dental.patient_details_controller",
{
"patients": custom_data,
},
)

@http.route(
["/home/dental/appointment/<int:record_id>"],
type="http",
auth="public",
website=True,
)
def show_patient_medical_appointment(self, record_id, **kwargs):
custom_data = request.env["dental.patient"].sudo().browse(record_id)
custom_history = custom_data.history_ids

return request.render(
"dental.patient_details_controller_appointment",
{
"patients": custom_history,
},
)
4 changes: 1 addition & 3 deletions dental/models/dental_patient.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from datetime import datetime, timedelta, date
from datetime import date
from odoo import fields, models, api, Command
from odoo.exceptions import UserError, ValidationError


class DentalPatient(models.Model):
Expand Down Expand Up @@ -79,7 +78,6 @@ class DentalPatient(models.Model):
def create_patient_invoice(self):
if self.state == "toinvoice":
for record in self:
print(record.gurantor.id)
values_property = {
"partner_id": record.gurantor.partner_id.id,
"move_type": "out_invoice",
Expand Down
13 changes: 13 additions & 0 deletions dental/static/description/Bill.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions dental/static/description/bag.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions dental/static/description/folder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions dental/static/description/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dental/static/description/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d7b5642

Please sign in to comment.