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] estate: added new real estate module #108

Draft
wants to merge 19 commits into
base: 17.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
4e7a1d6
[ADD] estate: added new real estate module
krku-odoo Aug 1, 2024
bf62bdf
[ADD] estate: added new property in estate module
krku-odoo Aug 2, 2024
f855aea
[ADD] estate: Created new models for property type, tags and offers
krku-odoo Aug 5, 2024
f0ae4ec
[ADD] estate: Created Action and Constraints
krku-odoo Aug 7, 2024
947622a
[ADD] estate: Add The Sprinkles
krku-odoo Aug 12, 2024
5e7c24a
[ADD] estate: Added inheritance to extend the functionality of curre…
krku-odoo Aug 13, 2024
250a74b
[ADD] estate: Added Interact With Other Modules
krku-odoo Aug 13, 2024
0e9c0c0
[ADD] estate: Added Kanban View
krku-odoo Aug 14, 2024
8e13d18
[IMP] estate: Add standard property types and demo data
krku-odoo Aug 20, 2024
d811ef0
[ADD] estate: Added PDF Reports to the estate module
krku-odoo Aug 21, 2024
3c09613
[IMP] estate: wizard,controllers,security
krku-odoo Aug 28, 2024
453d964
[ADD] dental: Created a new module
krku-odoo Sep 4, 2024
0937960
[IMP] dental: Add dental module with invoicing functionality
krku-odoo Sep 5, 2024
44a3499
[IMP] dental: Add controller
krku-odoo Sep 6, 2024
550b9d0
[IMP] dental: Add breadcrumb and create form view template
krku-odoo Sep 10, 2024
92478f7
[ADD] installment: Add Installment for sale order.
krku-odoo Sep 20, 2024
456c8ed
[ADD] warranty: Add waranty feature for sale order
krku-odoo Sep 24, 2024
335e94c
[IMP] warranty: Add warranty fetures.
krku-odoo Sep 25, 2024
6057707
[ADD] warranty: Add warranty end_date in invoice report create
krku-odoo Sep 27, 2024
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
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
22 changes: 22 additions & 0 deletions dental/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "Dental",
"version": "1.0",
"license": "LGPL-3",
"summary": "Manage properties",
"depends": ["base", "mail", "account"],
"data": [
"security/ir.model.access.csv",
"views/pateint_views.xml",
"views/medical_aids_views.xml",
"views/chronic_condition.xml",
"views/habits.xml",
"views/allergies.xml",
"views/medication.xml",
"views/dental_controller.xml",
"views/patient_history.xml",
"views/menuitem.xml",
],
"installable": True,
"application": True,
"auto_install": False,
}
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
152 changes: 152 additions & 0 deletions dental/controller/dental_controller.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
from odoo import http
from odoo.http import request


class DentalController(http.Controller):
# show dental on my account
@http.route(
[
"/dental",
],
type="http",
auth="public",
website=True,
)
def show_all_the_data(self, page=1, **kwargs):
user = request.env.user
page = int(page)
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,
},
)

# show all patient
@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,
},
)

# show personal detail
@http.route(
["/personal/detail/<int:record_id>"],
type="http",
auth="public",
website=True,
)
def show_personal_detail(self, record_id, **kwargs):
data = request.env["dental.patients"].sudo().browse(record_id)
return request.render(
"dental.personal_detail_template",
{
"personal": data,
},
)

# show medical Aid detail
@http.route(
["/patients/medical_aid/detail/<int:record_id>"],
type="http",
auth="public",
website=True,
)
def show_medical_aid_detail(self, record_id, **kwargs):
data = request.env["dental.patients"].sudo().browse(record_id)
medical_aid_id = data.medical_aid_id.id
medical_aid = (
request.env["medical.aids"]
.sudo()
.search(
[
("id", "=", medical_aid_id),
],
)
)
return request.render(
"dental.medical_aid_detail_template",
{
"medical_aid": medical_aid,
"patient": data,
},
)

# medical history
@http.route(
["/medical/history/<int:patient_id>"],
type="http",
auth="public",
website=True,
)
def show_medical_history(self, patient_id, **kwargs):
data = request.env["dental.patients"].sudo().browse(patient_id)
history_id = data.history_id
return request.render(
"dental.portal_medical_history_template",
{"history": history_id, "patient": data},
)

# dental history
@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)
history_id = data.history_id
return request.render(
"dental.dental_history_view",
{
"history": history_id,
"patient": data,
},
)

# Dental_history_detail
@http.route(
["/history/detail/<int:history_id>/<int:patient_id>"],
type="http",
auth="public",
website=True,
)
def show_dental_history_detail(self, history_id, patient_id, **kwargs):
patient = request.env["dental.patients"].sudo().browse(patient_id)
data = request.env["pateint.history"].sudo().browse(history_id)
return request.render(
"dental.dental_history_detail_view",
{
"history": data,
"patient": patient,
},
)
7 changes: 7 additions & 0 deletions dental/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from . import dental_patient
from . import medical_aids
from . import chronic_condition
from . import allergies
from . import habits
from . import medication
from . import patient_history
10 changes: 10 additions & 0 deletions dental/models/allergies.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from odoo import fields, models


class AllergiesModel(models.Model):
_name = "symptoms.allergies"
_description = "Medical Aids"
_inherit = ["mail.thread", "mail.activity.mixin"]

name = fields.Char()
sequence = fields.Integer("Sequence")
11 changes: 11 additions & 0 deletions dental/models/chronic_condition.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from odoo import fields, models


class ChronicModel(models.Model):
_name = "chronic.condition"
_description = "Medical Aids"
_inherit = ["mail.thread", "mail.activity.mixin"]

name = fields.Char()
sequence = fields.Integer("Sequence")
description = fields.Text()
102 changes: 102 additions & 0 deletions dental/models/dental_patient.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
from datetime import date
from odoo import Command, fields, models


class PatientModel(models.Model):
_name = "dental.patients"
_description = "Dental Patients"
_inherit = ["mail.thread", "mail.activity.mixin"]

name = fields.Char(required=True)
state = fields.Selection(
selection=[
("new", "New"),
("to do today", "To Do Today"),
("done", "Done"),
("to invoice", "To Invoice"),
],
tracking=True,
default="new",
)
image = fields.Image(string="Image")
sequence = fields.Integer("Sequence")
gp_name = fields.Many2one("res.partner", string="Gp's Name")
gp_phone = fields.Char(string="Gp's Phone", related="gp_name.phone", store=True)
chronic_ids = fields.Many2many("chronic.condition", string="Chronic Condition")
aleergies_ids = fields.Many2many("symptoms.allergies", string="Allergies")
habits_ids = fields.Many2many("symptoms.habits", string="Habits/Substance Abuse")
medication = fields.Many2many("medication", string="Medication")
hospitalised_this_year = fields.Text()
under_special_care = fields.Text(string="Under Specialist Care")
psychiatric_history = fields.Text(string="Psychiatric History")
gender = fields.Selection(
selection=[
("male", "Male"),
("female", "Female"),
("neither", "Neither"),
],
)
are_you_pregnant = fields.Boolean(string="Are You Pregnant")
are_you_nursing = fields.Boolean(string="Are You Nursing")
are_you_on = fields.Selection(
selection=[
("hormon replacement treatment", "Hormon Replacement Treatment"),
("birth control", "Birth Control"),
("neither", "Neither"),
],
)
notes = fields.Text()
medical_aid_id = fields.Many2one("medical.aids", string="Medical Aid")
medical_aid_plan = fields.Text(string="Medical Aid Plan")
medical_aid_number = fields.Text(string="Medical Aid Number")
main_member_code = fields.Text(string="Main Member Code")
dependant_code = fields.Text(string="Dependant Code")
occupation_or_grade = fields.Text(string="Occupation Or Grade")
identity_number = fields.Text(string="Identity Number")
date_of_birth = fields.Date(string="Date Of Birth")
marital_status = fields.Selection(
selection=[
("single", "single"),
("married", "married"),
("divorced", "divorced"),
("widowed", "widowed"),
],
string="Marital Status",
)
phone_number = fields.Char(string="Mobile")
history_id = fields.One2many("pateint.history", "patient_id", string="History")
guarantor_id = fields.Many2one("res.partner", string="Guarantor")
guarantor_phone = fields.Char(
string="Guarantor Phone", related="guarantor_id.phone", readonly=True
)
guarantor_email = fields.Char(
string="Guarantor Email", related="guarantor_id.email", readonly=True
)
guarantor_company = fields.Char(
string="Company", related="guarantor_id.parent_id.name"
)
guarantor_tags = fields.Many2many(string="Tags", related="guarantor_id.category_id")

def action_open_invoice(self):
if self.state == "to invoice":
for patient_id in self:
self.ensure_one()
invoice_obj = self.env["account.move"]
invoice_vals = {
"partner_id": patient_id.guarantor_id.id,
"move_type": "out_invoice",
"invoice_date": date.today(),
"state": "draft",
"ref": patient_id.name,
"invoice_line_ids": [
Command.create(
{
"name": patient_id.name,
"quantity": 1,
"price_unit": 1000 * 0.06,
"invoice_date": date.today(),
}
)
],
}
invoice_obj.create(invoice_vals)
10 changes: 10 additions & 0 deletions dental/models/habits.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from odoo import fields, models


class habitModel(models.Model):
_name = "symptoms.habits"
_description = "Habits"
_inherit = ["mail.thread", "mail.activity.mixin"]

name = fields.Char()
sequence = fields.Integer("Sequence")
29 changes: 29 additions & 0 deletions dental/models/medical_aids.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from odoo import fields, models


class MedicalAidsModel(models.Model):
_name = "medical.aids"
_description = "Medical Aids"
_inherit = ["mail.thread", "mail.activity.mixin"]

name = fields.Char(string="Name")
sequence = fields.Integer("Sequence")
contact = fields.Char(string="Contact")
phone_number = fields.Char(string="Phone Number")
email = fields.Char(string="Email")
company_id = fields.Many2one(
"res.company",
string="Company",
required=True,
default=lambda self: self.env.company,
)
notes = fields.Text()
state = fields.Selection(
selection=[
("new", "New"),
("in progress", "In Progress"),
("done", "Done"),
],
tracking=True,
default="new",
)
10 changes: 10 additions & 0 deletions dental/models/medication.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from odoo import fields, models


class MedicationModel(models.Model):
_name = "medication"
_description = "Medication"
_inherit = ["mail.thread", "mail.activity.mixin"]

name = fields.Char(string="Medication")
sequence = fields.Integer("Sequence")
Loading