Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dental-clinic-management to Odoo 18 #357

Open
wants to merge 1 commit into
base: 18.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions dental_clinical_management/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

Dental Clinic Management
========================
Dental Clinic Management is to manage the entire Dental Clinic.

Configuration
=============
* No additional configuration required

License
-------
GNU AFFERO GENERAL PUBLIC LICENSE v3.0 (AGPL-3)
(https://www.gnu.org/licenses/agpl-3.0-standalone.html)

Company
-------
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__

Credits
-------
* Developer: (V17) Kailas Krishna,
Contact: [email protected]

Contacts
--------
* Mail Contact : [email protected]
* Website : https://cybrosys.com

Bug Tracker
-----------
Bugs are tracked on GitHub Issues. In case of trouble, please check there if
your issue has already been reported.

Maintainer
==========
.. image:: https://cybrosys.com/images/logo.png
:target: https://cybrosys.com

This module is maintained by Cybrosys Technologies.

For support and more information, please visit `Our Website <https://cybrosys.com/>`__

Further information
===================
HTML Description: `<static/description/index.html>`__
24 changes: 24 additions & 0 deletions dental_clinical_management/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
#
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
# (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
from . import controllers
from . import models
from . import wizard
79 changes: 79 additions & 0 deletions dental_clinical_management/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# -*- coding: utf-8 -*-
################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
#
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
# (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
{
'name': 'Dental Clinic Management',
'version': '18.0.1.0.0',
'category': 'Services',
'summary': """Dental Clinic Management is to manage the entire dental clinic.""",
'description': """Dental Clinic Management software, dental clinics can
enhance efficiency, improve patient care, optimize resource utilization,
and maintain smooth operations.""",
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',
'website': "https://www.cybrosys.com",
'depends': ['hr', 'website', 'mail', 'sale_management', 'purchase','stock'],
'assets': {
'web.assets_frontend': [
"/dental_clinical_management/static/src/js/dental_clinic.js"
]
},
'data': [
'security/dental_clinical_management_groups.xml',
'security/dental_clinical_management_security.xml',
'security/ir.model.access.csv',
'data/ir_sequence.xml',
'data/dental_department_data.xml',
'data/dental_specialist_data.xml',
'data/treatment_category_data.xml',
'data/dental_treatment_data.xml',
'data/insurance_company_data.xml',
'data/medicine_frequency_data.xml',
'data/dental_time_shift_data.xml',
'data/website_menu.xml',
'views/dental_time_shift_views.xml',
'views/dental_department_views.xml',
'views/dental_doctor_views.xml',
'views/dental_patients_views.xml',
'views/dental_prescription_views.xml',
'views/dental_medicine_views.xml',
'views/dental_specialist_views.xml',
'views/dental_treatment_views.xml',
'views/insurance_company_views.xml',
'views/medicine_frequency_views.xml',
'views/medical_questions_views.xml',
'views/treatment_category_views.xml',
'views/dental_appointment_views.xml',
'views/patient_portal_template.xml',
'views/dental_clinic_template.xml',
'report/dental_appointment_card.xml',
'report/dental_prescription_templates.xml',
'report/dental_prescription_report.xml',
'wizard/xray_report_views.xml',
'views/dental_clinical_management_menu.xml',
],
'images': ['static/description/banner.jpg'],
'license': 'AGPL-3',
'installable': True,
'auto_install': False,
'application': True,
}
23 changes: 23 additions & 0 deletions dental_clinical_management/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
#
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
# (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
from . import dental_clinic
from . import patient_portal
124 changes: 124 additions & 0 deletions dental_clinical_management/controllers/dental_clinic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# -*- coding: utf-8 -*-
################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
#
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
# (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
from io import BytesIO
from reportlab.pdfgen import canvas

from odoo.exceptions import UserError
from odoo import _, http
from odoo.http import Controller, request, route, content_disposition


class DentalClinic(Controller):
"""Controller for a dental clinic website that allows users to view clinic
details and schedule appointments online."""

@route('/dental_doctor', auth='public', website=True)
def dental_clinic(self):
"""Renders the dental clinic page with patient, specialist, and doctor information.
This method retrieves the current user's partner ID as the patient ID,
fetches all records from the `dental.specialist` model, and all records
from the `hr.employee` model to display on the dental clinic webpage."""
patient_id = request.env.user.partner_id
specialised_id = request.env['dental.specialist'].sudo().search([])
doctor_id = request.env['hr.employee'].sudo().search([])
return request.render('dental_clinical_management.website_dental_template',
{'patient_id': patient_id,
'specialised_id': specialised_id,
'doctor_id': doctor_id})

@route('/create/appointment', auth='public', website=True)
def create_appointment(self, **kw):
"""To create a new appointment from website"""
if len(kw.get('time_shift')) == 0:
raise UserError(self.env._('Doctor Doesnot have the available appointment'))
else:
patient_appointment = request.env['dental.appointment'].sudo().create({
'patient_id': kw.get('patient'),
'patient_phone': kw.get('phone'),
'patient_age': kw.get('age'),
'specialist_id': kw.get('specialization', False),
'doctor_id': kw.get('doctor'),
'shift_id': kw.get('time_shift'),
'date': kw.get('date'),
})
return request.redirect(f'/success_appointment?token={patient_appointment.token_no}')

@route('/success_appointment', auth='public', website=True)
def success_appointment(self, **kwargs):
"""Return when appointment creation is success"""
return request.render(
'dental_clinical_management.website_rental_success_template', {'token': kwargs})

@http.route('/dental_clinic/appointment_card/<int:token>',
type='http', auth="public", website=True)
def appointment_card(self, token):
"""To download the appointment card for patients for doctor's appointment"""
appointment = request.env['dental.appointment'].sudo().browse(token)
if not appointment.exists():
return request.not_found()
data = {
'token': appointment.token_no,
'doctor': appointment.doctor_id.name,
'specialised': appointment.specialist_id.name,
'appointment_time': appointment.shift_id.name,
'date': appointment.date,
}
report_service = request.env['ir.actions.report']
pdf_content, _ = report_service._render_qweb_pdf(
'dental_clinical_management.action_appointment_card', data=data)
pdf_http_headers = [('Content-Type', 'application/pdf'),
('Content-Length', len(pdf_content))]
return request.make_response(pdf_content, headers=pdf_http_headers)

@route('/patient_details', type="json", auth='public', website=True)
def get_patient_details(self, patient_id):
"""Retrieve and return details of a specific patient by their ID.
This method accesses the `res.partner` model, retrieves a patient
record by the given ID, and returns selected fields of the patient
such as phone number and age.
Args:
patient_id (int): The unique identifier of the patient."""
patient = request.env['res.partner'].sudo().browse(int(patient_id))
return patient.read(fields=['phone', 'patient_age'])

@route('/specialised_doctors', type="json", auth='public', website=True)
def get_specialised_doctors(self, specialised_id):
"""To get the list of doctors based on their specialisation"""
domain = []
if specialised_id:
domain = [('specialised_in_id', '=', int(specialised_id))]
doctors = request.env['hr.employee'].sudo().search_read(domain, ["name"])
return doctors

@route('/doctors_shifts', type="json", auth='public', website=True)
def get_doctors_shifts(self, doctor_id):
"""To get the particular doctor time slots"""
doctors_shift = request.env['hr.employee'].sudo().browse(int(doctor_id)).time_shift_ids
time_shifts = [{"id": rec.id, "name": rec.name} for rec in doctors_shift]
return time_shifts

@route('/all_doctors', auth='public', website=True)
def get_all_doctors(self):
"""To list all the doctors"""
doctor_id = request.env['hr.employee'].sudo().search([])
return request.render('dental_clinical_management.website_all_doctors',
{'doctor_ids': doctor_id})
65 changes: 65 additions & 0 deletions dental_clinical_management/controllers/patient_portal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# -*- coding: utf-8 -*-
################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
#
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
# (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
from odoo import http
from odoo.http import request
from odoo.addons.portal.controllers import portal


class PatientPortal(portal.CustomerPortal):
"""Provide portal access for patients to view their treatment
details, prescriptions, and invoices."""
def _prepare_home_portal_values(self, counters):
"""Extends the base method to include the count of dental prescriptions
in the returned dictionary if requested.
Args:
counters (list): A list of strings indicating which counts to
include in the response."""
values = super()._prepare_home_portal_values(counters)
if 'prescriptions_count' in counters:
prescriptions_count = request.env['dental.prescription'].sudo().search_count([])
values['prescriptions_count'] = prescriptions_count
return values

@http.route(['/my/prescriptions'], type='http', auth="user", website=True)
def portal_my_prescriptions(self, **kwargs):
"""Renders the prescriptions page for the logged-in user based on their role.
Managers see all prescriptions, doctors see their own, and patients see
their own prescriptions."""
if request.env.ref('dental_clinical_management.group_dental_manager') in request.env.user.groups_id:
domain = []
elif request.env.ref('dental_clinical_management.group_dental_doctor') in request.env.user.groups_id:
domain = [('prescribed_doctor_id', '=', request.env.user.partner_id.employee_ids.id)]
else:
domain = [('patient_id', '=', request.env.user.partner_id.id)]
prescriptions = request.env['dental.prescription'].sudo().search(domain)
return request.render("dental_clinical_management.portal_my_prescriptions",
{'prescriptions': prescriptions, 'page_name': 'prescriptions'})

@http.route(['/view/prescriptions/<int:id>'],
type='http', auth="public", website=True)
def view_prescriptions(self, id):
"""View prescriptions based on the provided ID.
:param id: The ID of the prescription to view.
:return: Rendered template with prescription details."""
prescription = request.env['dental.prescription'].browse(id)
return request.render('dental_clinical_management.prescription_portal_template',
{'prescription_details': prescription, 'page_name': 'prescription'})
15 changes: 15 additions & 0 deletions dental_clinical_management/data/dental_department_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<!-- Dental department data -->
<record model="hr.department" id="clinical_department">
<field name="name">Clinical Department</field>
</record>
<record model="hr.department" id="telehealth_department">
<field name="name">Telehealth Department</field>
</record>
<record model="hr.department" id="quality_assurance">
<field name="name">Quality Assurance</field>
</record>
</data>
</odoo>
Loading