Skip to content

Commit

Permalink
[ADD] installment: created a module and added functionalities
Browse files Browse the repository at this point in the history
Created a module for managing installments, including a cron job for invoices.
Added a settings section specifically for installments.
Implemented a wizard for adding EMI (Equated Monthly Installments).
Introduced a button to redirect to the document module.
Implemented an invoice schedule that triggers when the delay process exceeds the
 specified days.
Added a smart button for document upload requests.
Developed a wizard for document requests related to sales orders.
  • Loading branch information
akya-odoo committed Sep 20, 2024
1 parent 0ca9e6e commit c1279d3
Show file tree
Hide file tree
Showing 20 changed files with 895 additions and 145 deletions.
85 changes: 62 additions & 23 deletions dental/controller/dental_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,44 @@

class DentalController(http.Controller):

@http.route("/dental", auth="public", website=True)
def display_patients(self):
@http.route(
["/home/dental", "/home/dental/page/<int:page>"], auth="public", website=True
)
def display_patients(self, page=1):
patients_per_page = 4
current_user = request.env.user
patients = request.env["dental.patient"].search(
[("guarantor_id", "=", current_user.partner_id.id)]

total_patients = (
request.env["dental.patient"]
.sudo()
.search_count([("guarantor_id", "=", current_user.partner_id.id)])
)

pager = request.website.pager(
url="/home/dental",
total=total_patients,
page=page,
step=patients_per_page,
)
return request.render("dental.dental_patient_page", {"patients": patients})

@http.route("/dental/<string:patient_name>", auth="public", website=True)
def display_patient_details(self, patient_name):
patient = (
patients = (
request.env["dental.patient"]
.sudo()
.search([("name", "=", patient_name)], limit=1)
.search(
[("guarantor_id", "=", current_user.partner_id.id)],
offset=pager["offset"],
limit=patients_per_page,
)
)

return request.render(
"dental.dental_patient_page", {"patients": patients, "pager": pager}
)

@http.route("/home/dental/<int:record_id>", auth="public", website=True)
def display_patient_details(self, record_id):
patient = request.env["dental.patient"].sudo().browse(record_id)

if not patient:
return request.not_found()

Expand All @@ -28,36 +50,53 @@ def display_patient_details(self, patient_name):
)

@http.route(
"/dental/<string:patient_name>/personal",
"/home/dental/<int:record_id>/personal",
type="http",
auth="public",
website=True,
)
def render_dental_patient_form(self, patient_name):
patient = (
request.env["dental.patient"]
.sudo()
.search([("name", "=", patient_name)], limit=1)
)
def render_dental_patient_form(self, record_id):
patient = request.env["dental.patient"].sudo().browse(record_id)
return request.render(
"dental.dental_patient_form_template",
"dental.dental_patient_personal_details",
{
"patient": patient,
},
)

@http.route("/home/dental/<int:record_id>/medical_aid", auth="user", website=True)
def medical_aid_details(self, record_id):
patient = http.request.env["dental.patient"].sudo().browse(record_id)
return http.request.render(
"dental.dental_patient_medical_aid_details",
{
"patient": patient,
},
)

@http.route(
"/dental/<string:patient_name>/medical_history",
"/home/dental/<int:record_id>/medical_history",
type="http",
auth="public",
website=True,
)
def dental_history_list_view(self, patient_name):
patient = (
request.env["dental.patient"]
.sudo()
.search([("name", "=", patient_name)], limit=1)
def medical_history_view(self, record_id):
patient = request.env["dental.patient"].sudo().browse(record_id)
return request.render(
"dental.dental_history_list_view",
{
"patients": patient.history_ids,
},
)

@http.route(
"/home/dental/<int:record_id>/appointment",
type="http",
auth="public",
website=True,
)
def dental_history_list_view(self, record_id):
patient = request.env["dental.patient"].sudo().browse(record_id)
return request.render(
"dental.patient_details_controller_appointment",
{
Expand Down
94 changes: 88 additions & 6 deletions dental/report/dental_patient_report_template.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_patient">
<t t-call="web.external_layout">
<main>
<h1>Hello</h1>
</main>
<template id="dental_patient_report_template">
<t t-foreach="docs" t-as="record">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<div class="page">
<h2 class="text-center">
<strong>Patient Name: </strong>
<span t-field="record.name"/>
</h2>
<div class="mt-4">
<h3>Guarantor Information</h3>
<p>
<strong>Guarantor:</strong>
<span t-field="record.guarantor_id"/>
</p>
<p>
<strong>Phone:</strong>
<span t-field="record.guarantor_phone"/>
</p>
<p>
<strong>Email:</strong>
<span t-field="record.guarantor_email"/>
</p>
<p>
<strong>Company:</strong>
<span t-field="record.guarantor_company"/>
</p>
</div>
<div class="mt-4">
<h3>Medical Aid Information</h3>
<p>
<strong>Medical Aid:</strong>
<span t-field="record.medical_aid_id"/>
</p>
<p>
<strong>Plan:</strong>
<span t-field="record.medical_aid_plan"/>
</p>
<p>
<strong>Medical Aid Number:</strong>
<span t-field="record.medical_aid_number"/>
</p>
<p>
<strong>Main Member Code:</strong>
<span t-field="record.member_code"/>
</p>
<p>
<strong>Dependant Code:</strong>
<span t-field="record.dependant_code"/>
</p>
</div>
<div class="mt-4">
<h3>Emergency Contact</h3>
<p>
<strong>Contact:</strong>
<span t-field="record.emergency_contact_id"/>
</p>
<p>
<strong>Phone:</strong>
<span t-field="record.emergency_contact_phone"/>
</p>
</div>
<div class="mt-4">
<h3>Medical Information</h3>
<p>
<strong>Chronic Conditions:</strong>
<t t-foreach="record.chronic_conditions_ids" t-as="condition">
<span class="badge bg-warning" t-field="condition.name"/>
</t>
</p>
<p>
<strong>Allergies:</strong>
<t t-foreach="record.allergy_ids" t-as="allergy">
<span class="badge bg-danger" t-field="allergy.name"/>
</t>
</p>
<p>
<strong>Habits/Substance Abuse:</strong>
<t t-foreach="record.habit_ids" t-as="habit">
<span class="badge bg-info" t-field="habit.name"/>
</t>
</p>
</div>
</div>
</t>
</t>
</t>
</template>
</odoo>
</odoo>
File renamed without changes
Loading

0 comments on commit c1279d3

Please sign in to comment.