Skip to content

Commit

Permalink
[ADD] dental: created the dental module
Browse files Browse the repository at this point in the history
After this commit:
-added patients
-added medical patients
-added symptoms
-added mdication
  • Loading branch information
smee-odoo committed Sep 4, 2024
1 parent 0e03e08 commit e9361ec
Show file tree
Hide file tree
Showing 14 changed files with 509 additions and 2 deletions.
2 changes: 2 additions & 0 deletions dental/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import controller
23 changes: 23 additions & 0 deletions dental/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
'name': 'DENTAL',
'version': '1.2',
'description': "",
'depends': [
'base_setup', 'website'
],
'data': [
'security/ir.model.access.csv',

'views/dental_views.xml',
'views/medical_aids_views.xml',
'views/medical_symptoms_views.xml',
'views/medication_views.xml',
'views/dental_menu.xml',
],
'demo': [

],
'installable': True,
'application': True,
'license': 'LGPL-3'
}
4 changes: 4 additions & 0 deletions dental/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import dental_patients
from . import medical_aids
from . import medical_symptoms
from . import medication
54 changes: 54 additions & 0 deletions dental/models/dental_patients.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
from odoo import models, fields
from datetime import date
from dateutil.relativedelta import relativedelta


class DentalPatients(models.Model):
_name = "dental.patient"
_description = "patients"

name = fields.Char(string='Name', required=True)
stage = fields.Selection(
string='Stage',
selection=[('new', 'New'), ('to do today', 'To Do Today'), ('done', 'Done'), ('to invoice', 'To Invoice')],
help='stage of the appointment',
required=True,
default='new')
doctor_id = fields.Many2one(
'res.partner',
string="GP's Name",
copy=False,
help="The Genereal practioner for this patient")
company_id = fields.Many2one(
'res.company',
string="Company",
copy=False
)
phone_number = fields.Char(string="GP's Phone", related="doctor_id.phone")
chronic_conditions_ids = fields.Many2many('chronic.conditions', string="Chronic Condtions")
allergies_ids = fields.Many2many('dental.allergies', string="Allergies")
habits_substance_ids = fields.Many2many('habits.substance', string="Habits and substance abuse")
medication_ids = fields.Many2many('dental.medication', string="Medication")
hospitialized = fields.Char(string="Hospitalized this year")
specialized_care = fields.Char(string="Under Specialist Care")
psychiatric_history = fields.Char(string="Psychiatric history")
gender = fields.Selection(
string="Gender",
selection=[('female', 'Female'), ('male', 'Male'), ('neither', 'Neither')],
required=True,
default='neither')
pregnant = fields.Boolean(string="Are you pregnant?", required=True, default=False)
nursing = fields.Boolean(string="Are you nursing?", required=True, default=False)
hormone = fields.Selection(
string="Are you on hormone therapy?",
selection=[('hrt', 'Hormone Replacement Treatment'), ('birth control', 'Birth Conrol'), ('neither', 'Neither')],
required=True,
default='neither')
occupation = fields.Char(string="Occupation")
identity_num = fields.Char(string="Identity number")
birthdate = fields.Date(string="Date of birth", required=True)
maritial_status = fields.Selection(
string="Maritial Status",
selection=[('single', 'Single'), ('married', 'Married'), ('divorced', 'Divorced'), ('widowed', 'Widowed')],
required=True,
default='single')
23 changes: 23 additions & 0 deletions dental/models/medical_aids.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from odoo import models, fields


class MedicalAids(models.Model):
_name = "medical.aids"
_description = "Medical Insurance Info"

name = fields.Char(string='Name', required=True)
partner_id = fields.Many2one(
'res.partner',
string='Contact',
copy=False,
help='Insured Patient')
phone_number = fields.Char(string='Phone Number')
email_address = fields.Char(string='Email ID')
company_id = fields.Many2one(
'res.company',
string='Company',
required=True,
default=lambda self: self.env.company.id
)
note = fields.Text(string="")
image = fields.Image(string="")
30 changes: 30 additions & 0 deletions dental/models/medical_symptoms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from odoo import models, fields


class MedicalSymptoms(models.Model):
_name = "medical.symptoms"
_description = "All the underlying conditions"

name = fields.Char(string='Name', required=True)
sequence = fields.Integer('Sequence', default=1, help="Used to order types. Lower is better.")
parent_id = fields.Many2one('medical.symptoms')

class ChronicConditions(models.Model):
_name = "chronic.conditions"
_description = "Chronic medical symptoms"
_inherits = {'medical.symptoms':'medical_symptoms_id'}

medical_symptoms_id = fields.Many2one('medical.symptoms')
class Allergies(models.Model):
_name = "dental.allergies"
_description = "Allergies"
_inherits = {'medical.symptoms':'medical_symptoms_id'}

medical_symptoms_id = fields.Many2one('medical.symptoms')

class HabitsSubstance(models.Model):
_name = "habits.substance"
_description = "Habits and substance abuse info"
_inherits = {'medical.symptoms':'medical_symptoms_id'}

medical_symptoms_id = fields.Many2one('medical.symptoms')
9 changes: 9 additions & 0 deletions dental/models/medication.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from odoo import models, fields


class Medication(models.Model):
_name = "dental.medication"
_description = "Medicinal Info"

name = fields.Char(string='Name', required=True)
sequence = fields.Integer('Sequence', default=1, help="Used to order types. Lower is better.")
8 changes: 8 additions & 0 deletions dental/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
dental.access_dental_patient,access_dental_patient,dental.model_dental_patient,base.group_user,1,1,1,1
dental.access_medical_aids,access_medical_aids,dental.model_medical_aids,base.group_user,1,1,1,1
dental.access_medical_symptoms,access_medical_symptoms,dental.model_medical_symptoms,base.group_user,1,1,1,1
dental.access_chronic_conditions,access_chronic_conditions,dental.model_chronic_conditions,base.group_user,1,1,1,1
dental.access_dental_allergies,access_dental_allergies,dental.model_dental_allergies,base.group_user,1,1,1,1
dental.access_habits_substance,access_habits_substance,dental.model_habits_substance,base.group_user,1,1,1,1
dental.access_dental_medication,access_dental_medication,dental.model_dental_medication,base.group_user,1,1,1,1
19 changes: 19 additions & 0 deletions dental/views/dental_menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<odoo>
<menuitem id="dental_menu_root" name="Dental" />

<menuitem id="dental_first_menu" name="Patients" parent="dental_menu_root"
action="dental_patient_action" />

<menuitem id="dental_second_menu" name="Medical Aids" parent="dental_menu_root" action="medical_aids_menu_action" />

<menuitem id="dental_third_menu" name="Medical Symptoms" parent="dental_menu_root">
<menuitem id="chronic_conditions_menu" name="Chronic Conditions" action="chronic_conditions_menu_action" />
<menuitem id="allergies_menu" name="Allergies" action="allergies_menu_action" />
<menuitem id="habits_substance_menu" name="Habits/Substance Abuse" action="habits_substance_menu_action" />
</menuitem>

<menuitem id="dental_fourth_menu" name="Medication" parent="dental_menu_root" action="dental_medication_menu_action" />

<menuitem id="dental_fifth_menu" name="Configuration" parent="dental_menu_root" />
</odoo>
122 changes: 122 additions & 0 deletions dental/views/dental_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<?xml version="1.0"?>
<odoo>
<record id="dental_patient_action" model="ir.actions.act_window">
<field name="name">Patients</field>
<field name="res_model">dental.patient</field>
<field name="view_mode">kanban,tree,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create New Property
</p>
</field>
</record>

<record id="view_dental_patient_tree" model="ir.ui.view">
<field name="name">dental.patient.tree</field>
<field name="model">dental.patient</field>
<field name="arch" type="xml">
<tree>
<field name="name" />
</tree>
</field>
</record>

<record id="view_dental_patient_kanban" model="ir.ui.view">
<field name="name">dental.patient.kanban</field>
<field name="model">dental.patient</field>
<field name="arch" type="xml">
<kanban default_group_by="stage" sortable="True">
<field name="stage" invisible="1"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div>
<strong>
<field name="name" />
</strong>
</div>
</div>
</t>
</templates>
<quick_create name="stage"/>
<column name="stage" options="{'sortable': True, 'foldable': True}">
<header>
<field name="name"/>
</header>
</column>
</kanban>
</field>
</record>

<record id="dental_patient_view_form" model="ir.ui.view">
<field name="name">dental.patient.form</field>
<field name="model">dental.patient</field>
<field name="arch" type="xml">
<form string="Property">
<sheet>
<group>
<h1>
<group>
<field name="name" />
</group>
</h1>
<group></group>
<group>
<field name="state" />
<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color'}" />
<field name="property_type_id" options="{'no_create': True, 'no_open': True}" />
<field name="postcode" />
<field name="date_availability" />
<field name="company_id" />
</group>
<group>
<field name="expected_price" />
<field name="selling_price" />
<field name="best_price" />
</group>
</group>
<notebook>
<page string="Description">
<group>
<field string="Bedrooms" name="bedrooms" />
<field name="living_area" />
<field name="facades" />
<field name="garage" />
<field name="garden" />
<field name="garden_area" invisible="not garden" />
<field name="garden_orientation" invisible="not garden" />
<field name="state" />
<field name='total_area' />
</group>
</page>
<page string="Offers">
<group>
<field name="offer_ids"
readonly="state == 'offer accepted' or state == 'sold' or state == 'cancelled'">
<tree string="Offers" editable="bottom" decoration-success="status == 'accepted'"
decoration-danger="status == 'refused'">
<field name="price" />
<field name="partner_id" />
<field name="status" optional="status == 'accepted' or status == 'refused'" />
<button name="action_accept_button" type="object" string="Accept"
icon="fa-check" invisible="status == 'accepted' or status == 'refused'" />
<button name="action_refuse_button" type="object" string="Refuse"
icon="fa-level-down" invisible="status == 'accepted' or status == 'refused'" />
<field name="validity" />
<field name="date_deadline" />
</tree>
</field>
</group>
</page>
<page string="Other Info">
<group>
<field name="seller_id" />
<field name="buyer_id" />
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
</odoo>
53 changes: 53 additions & 0 deletions dental/views/medical_aids_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0"?>
<odoo>
<record id="medical_aids_menu_action" model="ir.actions.act_window">
<field name="name">Medical Aids</field>
<field name="res_model">medical.aids</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create New Property
</p>
</field>
</record>

<record id="view_medical_aids_tree" model="ir.ui.view">
<field name="name">medical.aids.tree</field>
<field name="model">medical.aids</field>
<field name="arch" type="xml">
<tree>
<field name="name" />
</tree>
</field>
</record>

<record id="view_medical_aids_form" model="ir.ui.view">
<field name="name">medical.aids.form</field>
<field name="model">medical.aids</field>
<field name="arch" type="xml">
<form>
<sheet>
<field name="image" widget="image" class="oe_avatar" />
<div class="oe_title">
<h1>
<field name="name" />
</h1>
</div>
<group>
<group>
<field name="partner_id" />
<field name="phone_number" />
<field name="email_address" />
</group>
<group>
<field name="company_id" />
</group>
</group>
<div>
<field name="note" placeholder="Type your notes here"/>
</div>
</sheet>
</form>
</field>
</record>
</odoo>
Loading

0 comments on commit e9361ec

Please sign in to comment.