Browse Source

[ADD] Initial Commit

pull/45/merge
SHEREEF PT 8 years ago
parent
commit
b356094b21
  1. 37
      medical_lab_management/README.rst
  2. 22
      medical_lab_management/__init__.py
  3. 55
      medical_lab_management/__manifest__.py
  4. 19
      medical_lab_management/models/__init__.py
  5. 24
      medical_lab_management/models/account_invoice.py
  6. 180
      medical_lab_management/models/lab_appointment.py
  7. 66
      medical_lab_management/models/lab_patient.py
  8. 117
      medical_lab_management/models/lab_request.py
  9. 24
      medical_lab_management/models/lab_test_content_type.py
  10. 31
      medical_lab_management/models/lab_test_type.py
  11. 22
      medical_lab_management/models/physician_speciality.py
  12. 20
      medical_lab_management/models/res_partner.py
  13. 19
      medical_lab_management/models/testing_unit.py
  14. 60
      medical_lab_management/report/lab_patient_card.xml
  15. 54
      medical_lab_management/report/lab_test_report.xml
  16. 23
      medical_lab_management/report/report.xml
  17. 19
      medical_lab_management/security/ir.model.access.csv
  18. 17
      medical_lab_management/security/lab_users.xml
  19. BIN
      medical_lab_management/static/description/app.png
  20. BIN
      medical_lab_management/static/description/banner.jpg
  21. BIN
      medical_lab_management/static/description/card.png
  22. BIN
      medical_lab_management/static/description/content.png
  23. BIN
      medical_lab_management/static/description/cybro_logo.png
  24. BIN
      medical_lab_management/static/description/icon.png
  25. 270
      medical_lab_management/static/description/index.html
  26. BIN
      medical_lab_management/static/description/invoice.png
  27. BIN
      medical_lab_management/static/description/mail.png
  28. BIN
      medical_lab_management/static/description/patient.png
  29. BIN
      medical_lab_management/static/description/phy.png
  30. BIN
      medical_lab_management/static/description/request1.png
  31. BIN
      medical_lab_management/static/description/request2.png
  32. BIN
      medical_lab_management/static/description/result.png
  33. BIN
      medical_lab_management/static/description/test.png
  34. BIN
      medical_lab_management/static/description/today.png
  35. BIN
      medical_lab_management/static/description/unit.png
  36. BIN
      medical_lab_management/static/description/user.png
  37. 30
      medical_lab_management/views/account_invoice.xml
  38. 232
      medical_lab_management/views/lab_appointment.xml
  39. 157
      medical_lab_management/views/lab_patient_view.xml
  40. 121
      medical_lab_management/views/lab_request.xml
  41. 72
      medical_lab_management/views/lab_test_content_type.xml
  42. 102
      medical_lab_management/views/lab_test_type.xml
  43. 25
      medical_lab_management/views/physician_details.xml
  44. 18
      medical_lab_management/views/physician_specialty.xml
  45. 22
      medical_lab_management/views/res_partner.xml
  46. 72
      medical_lab_management/views/test_unit_view.xml

37
medical_lab_management/README.rst

@ -0,0 +1,37 @@
==========================
Medical Lab Management v10
==========================
Helps You To Manage Medical Lab Operations.
Installation
============
Just install the module from apps list.
Configuration
=============
#1.Create test units for lab test.
#2.Create test contents for lab test.
#3.Create lab test, add the contents and their units and normal range for the contents.
#4.Create patients.
#5.When a particular patient comes first create the patient and from the
super button in the patient name called 'Lab Appointments' create the appointment for the patient.
#6.When we confirm the appointment an email will be sent to the patient with the appointment Details.
#7.When we click on 'Request LAb' button lab test request will be created.
#8.Select the particular lab request and add the result when we complete the test.
#9.The request tree view will show green color if the test state is in Sample collection or Test in progress.
#10.The request tree view will show grey color if the test is cancelled ,it show blue color if the request is in draft stage and
it show black color if the test is completed.
#11.When the test request are completed the Appointment state will be in 'Test Result' state .
#12.Create invoice for the lab test.
#13.There is two type of users 'Lab technician' and 'lab User'. Lab technician have the right to create,delete,read lab test unit,test content,lab test
while the lab user have only read permission on these records. The other rights are same to both the user.
Credits
=======
Anusha P P @ cybrosys, anusha@cybrosys.in
Author
=======
Cybrosys Techno Solutions www.cybrosys.com

22
medical_lab_management/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
###################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Anusha P P(<https://www.cybrosys.com>)
#
# This program is free software: you can modify
# it under the terms of the GNU Affero General Public License (AGPL) as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# 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 for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
###################################################################################
from . import models

55
medical_lab_management/__manifest__.py

@ -0,0 +1,55 @@
# -*- coding: utf-8 -*-
###################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Anusha P P(<https://www.cybrosys.com>)
#
# This program is free software: you can modify
# it under the terms of the GNU Affero General Public License (AGPL) as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# 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 for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
###################################################################################
{
'name': "Medical Lab Management",
'version': '10.0.1.0.0',
'summary': """Manage Medical Lab Operations.""",
'description': """Manage Medical Lab General Operations.""",
'author': "Cybrosys Techno Solutions",
'maintainer': 'Cybrosys Techno Solutions',
'company': "Cybrosys Techno Solutions",
'website': "https://www.cybrosys.com",
'category': 'Industries',
'depends': ['base', 'mail', 'account'],
'data': [
'security/lab_users.xml',
'security/ir.model.access.csv',
'views/res_partner.xml',
'views/lab_patient_view.xml',
'views/test_unit_view.xml',
'views/lab_test_type.xml',
'views/lab_test_content_type.xml',
'views/physician_specialty.xml',
'views/physician_details.xml',
'views/lab_request.xml',
'views/lab_appointment.xml',
'views/account_invoice.xml',
'report/report.xml',
'report/lab_test_report.xml',
'report/lab_patient_card.xml',
],
'images': ['static/description/banner.jpg'],
'license': 'AGPL-3',
'installable': True,
'auto_install': False,
'application': True,
}

19
medical_lab_management/models/__init__.py

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Maintainer: Cybrosys Technologies (<https://www.cybrosys.com>)
#
##############################################################################
from . import physician_speciality
from . import res_partner
from . import lab_patient
from . import testing_unit
from . import lab_test_type
from . import lab_test_content_type
from . import lab_appointment
from . import lab_request
from . import account_invoice

24
medical_lab_management/models/account_invoice.py

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Maintainer: Cybrosys Technologies (<https://www.cybrosys.com>)
#
##############################################################################
from odoo import models, fields, api
class LabRequestInvoices(models.Model):
_inherit = 'account.invoice'
is_lab_invoice = fields.Boolean(string="Is Lab Invoice")
lab_request = fields.Many2one('lab.appointment', string="Lab Appointment", help="Source Document")
@api.multi
def action_invoice_paid(self):
res = super(LabRequestInvoices, self).action_invoice_paid()
lab_app_obj = self.env['lab.appointment'].search([('id', '=', self.lab_request.id)])
for obj in lab_app_obj:
obj.write({'state': 'invoiced'})
return res

180
medical_lab_management/models/lab_appointment.py

@ -0,0 +1,180 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Maintainer: Cybrosys Technologies (<https://www.cybrosys.com>)
#
##############################################################################
import datetime
from odoo.exceptions import UserError
from odoo import fields, models, api, _
class Appointment(models.Model):
_name = 'lab.appointment'
_inherit = ['mail.thread', 'ir.needaction_mixin']
_rec_name = 'name'
_description = "Appointment"
_order = 'appointment_date'
user_id = fields.Many2one('res.users', 'Responsible', readonly=True)
patient_id = fields.Many2one('lab.patient', string='Patient', required=True, select=True,
help='Patient Name')
name = fields.Char(string='Appointment ID', readonly=True, default=lambda self: _('New'))
date = fields.Datetime(string='Requested Date', default=lambda s: fields.Datetime.now(),
help="This is the date in which patient appointment is noted")
appointment_date = fields.Datetime(string='Appointment Date', default=lambda s: fields.Datetime.now(),
help="This is the appointment date")
physician_id = fields.Many2one('res.partner', string='Referred By', select=True)
comment = fields.Text(string='Comments')
appointment_lines = fields.One2many('lab.appointment.lines', 'test_line_appointment', string="Test Request")
request_count = fields.Integer(compute="_compute_state", string='# of Requests', copy=False, default=0)
inv_count = fields.Integer(compute="_compute_state", string='# of Invoices', copy=False, default=0)
state = fields.Selection([
('draft', 'Draft'),
('confirm', 'Confirmed'),
('request_lab', 'Lab Requested'),
('completed', 'Test Result'),
('to_invoice', 'To Invoice'),
('invoiced', 'Done'),
('cancel', 'Cancelled'),
], string='Status', readonly=True, copy=False, index=True, track_visibility='onchange', default='draft',
)
priority = fields.Selection([
('0', 'Low'),
('1', 'Normal'),
('2', 'High')
], size=1)
_defaults = {
'priority': '0',
}
@api.model
def create(self, vals):
if vals:
vals['name'] = self.env['ir.sequence'].next_by_code('lab.appointment') or _('New')
result = super(Appointment, self).create(vals)
return result
@api.multi
def _compute_state(self):
for obj in self:
obj.request_count = self.env['lab.request'].search_count([('app_id', '=', obj.id)])
obj.inv_count = self.env['account.invoice'].search_count([('lab_request', '=', obj.id)])
@api.multi
def create_invoice(self):
invoice_obj = self.env["account.invoice"]
invoice_line_obj = self.env["account.invoice.line"]
for lab in self:
lab.write({'state': 'to_invoice'})
if lab.patient_id:
curr_invoice = {
'partner_id': lab.patient_id.patient.id,
'account_id': lab.patient_id.patient.property_account_receivable_id.id,
'state': 'draft',
'type': 'out_invoice',
'date_invoice': datetime.datetime.now(),
'origin': "Lab Test# : " + lab.name,
'target': 'new',
'lab_request': lab.id,
'is_lab_invoice': True
}
inv_ids = invoice_obj.create(curr_invoice)
inv_id = inv_ids.id
if inv_ids:
journal = self.env['account.journal'].search([('type', '=', 'sale')], limit=1)
prd_account_id = journal.default_credit_account_id.id
if lab.appointment_lines:
for line in lab.appointment_lines:
curr_invoice_line = {
'name': line.lab_test.lab_test,
'price_unit': line.cost or 0,
'quantity': 1.0,
'account_id': prd_account_id,
'invoice_id': inv_id,
}
invoice_line_obj.create(curr_invoice_line)
# self.write({'state': 'invoiced'})
form_view_ref = self.env.ref('account.invoice_form', False)
tree_view_ref = self.env.ref('account.invoice_tree', False)
return {
'domain': "[('id', '=', " + str(inv_id) + ")]",
'name': 'Lab Invoices',
'view_mode': 'form',
'res_model': 'account.invoice',
'type': 'ir.actions.act_window',
'views': [(tree_view_ref.id, 'tree'), (form_view_ref.id, 'form')],
}
@api.multi
def action_request(self):
if self.appointment_lines:
for line in self.appointment_lines:
data = self.env['lab.test'].search([('lab_test', '=', line.lab_test.lab_test)])
self.env['lab.request'].create({'lab_request_id': self.name,
'app_id': self.id,
'lab_requestor': self.patient_id.id,
'lab_requesting_date': self.appointment_date,
'test_request': line.lab_test.id,
'request_line': [(6, 0, [x.id for x in data.test_lines])],
})
self.state = 'request_lab'
else:
raise UserError(_('Please Select Lab Test.'))
@api.multi
def confirm_appointment(self):
message_body = "Dear " + self.patient_id.patient.name + "," + "<br>Your Appointment Has been Confirmed " \
+ "<br>Appointment ID : " + self.name + "<br>Date : " + self.appointment_date + \
'<br><br>Thank you'
template_obj = self.env['mail.mail']
template_data = {
'subject': 'Appointment Confirmation',
'body_html': message_body,
'email_from': self.env.user.company_id.email,
'email_to': self.patient_id.email
}
template_id = template_obj.create(template_data)
template_obj.send(template_id)
self.write({'state': 'confirm'})
@api.multi
def cancel_appointment(self):
return self.write({'state': 'cancel'})
class LabAppointmentLines(models.Model):
_name = 'lab.appointment.lines'
lab_test = fields.Many2one('lab.test', string="Test")
cost = fields.Char(string="Cost")
requesting_date = fields.Date(string="Date")
test_line_appointment = fields.Many2one('lab.appointment', string="Appointment")
@api.onchange('lab_test')
def cost_update(self):
if self.lab_test:
self.cost = self.lab_test.test_cost
class LabPatientInherit(models.Model):
_inherit = 'lab.patient'
app_count = fields.Integer(compute="_compute_state", string='# of Appointments', copy=False, default=0)
@api.multi
def _compute_state(self):
for obj in self:
obj.app_count = self.env['lab.appointment'].search_count([('patient_id', '=', obj.id)])

66
medical_lab_management/models/lab_patient.py

@ -0,0 +1,66 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Maintainer: Cybrosys Technologies (<https://www.cybrosys.com>)
#
##############################################################################
from dateutil.relativedelta import relativedelta
from odoo import models, fields, api, _
class LabPatient(models.Model):
_name = 'lab.patient'
_rec_name = 'patient'
_description = 'Patient'
patient = fields.Many2one('res.partner', string='Partner', required=True)
patient_image = fields.Binary(string='Photo')
patient_id = fields.Char(string='Patient ID', readonly=True)
name = fields.Char(string='Patient ID', default=lambda self: _('New'))
title = fields.Selection([
('ms', 'Miss'),
('mister', 'Mister'),
('mrs', 'Mrs'),
], string='Title', default='mister', required=True)
emergency_contact = fields.Many2one(
'res.partner', string='Emergency Contact')
gender = fields.Selection(
[('m', 'Male'), ('f', 'Female'),
('ot', 'Other')], 'Gender', required=True)
dob = fields.Date(string='Date Of Birth', required=True)
age = fields.Char(string='Age', compute='compute_age')
blood_group = fields.Selection(
[('A+', 'A+ve'), ('B+', 'B+ve'), ('O+', 'O+ve'), ('AB+', 'AB+ve'),
('A-', 'A-ve'), ('B-', 'B-ve'), ('O-', 'O-ve'), ('AB-', 'AB-ve')],
'Blood Group')
visa_info = fields.Char(string='Visa Info', size=64)
id_proof_number = fields.Char(string='ID Proof Number')
note = fields.Text(string='Note')
date = fields.Datetime(string='Date Requested', default=lambda s: fields.Datetime.now(), invisible=True)
phone = fields.Char(string="Phone", required=True)
email = fields.Char(string="Email", required=True)
@api.multi
def compute_age(self):
for data in self:
if data.dob:
dob = fields.Datetime.from_string(data.dob)
date = fields.Datetime.from_string(data.date)
delta = relativedelta(date, dob)
data.age = str(delta.years) + ' years'
@api.model
def create(self, vals):
sequence = self.env['ir.sequence'].next_by_code('lab.patient')
vals['name'] = sequence or _('New')
result = super(LabPatient, self).create(vals)
return result
@api.onchange('patient')
def detail_get(self):
self.phone = self.patient.phone
self.email = self.patient.email

117
medical_lab_management/models/lab_request.py

@ -0,0 +1,117 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Maintainer: Cybrosys Technologies (<https://www.cybrosys.com>)
#
##############################################################################
import datetime
from odoo import models, fields, api
class LabRequest(models.Model):
_name = 'lab.request'
_inherit = ['mail.thread', 'ir.needaction_mixin']
_rec_name = 'lab_request_id'
_description = 'Lab Request'
name = fields.Char(string='Lab Test', size=16, readonly=True, required=True, help="Lab result ID", default=lambda *a: '#')
lab_request_id = fields.Char(string='Appointment ID', help="Lab appointment ID")
app_id = fields.Many2one('lab.appointment', string='Appointment')
lab_requestor = fields.Many2one('lab.patient', string='Patient', required=True, select=True,
help='Patient Name')
test_request = fields.Many2one('lab.test', string='Test')
lab_requesting_date = fields.Datetime(string='Requested Date')
comment = fields.Text('Comment')
request_line = fields.One2many('lab.test.attribute', 'test_request_reverse', string="Test Lines")
state = fields.Selection([
('draft', 'Draft'),
('sample_collection', 'Sample Collected'),
('test_in_progress', 'Test In Progress'),
('completed', 'Completed'),
('cancel', 'Cancelled'),
], string='Status', readonly=True, copy=False, index=True, track_visibility='onchange', default='draft')
@api.model
def create(self, vals):
sequence = self.env['ir.sequence'].next_by_code('lab.request')
vals['name'] = sequence or '/'
return super(LabRequest, self).create(vals)
@api.multi
def set_to_sample_collection(self):
return self.write({'state': 'sample_collection'})
@api.multi
def set_to_test_in_progress(self):
return self.write({'state': 'test_in_progress'})
@api.multi
def cancel_lab_test(self):
return self.write({'state': 'cancel'})
@api.multi
def set_to_test_completed(self):
req_obj = self.env['lab.request'].search_count([('app_id', '=', self.app_id.id),
('id', '!=', self.id)])
req_obj_count = self.env['lab.request'].search_count([('app_id', '=', self.app_id.id),
('id', '!=', self.id),
('state', '=', 'completed')])
if req_obj == req_obj_count:
app_obj = self.env['lab.appointment'].search([('id', '=', self.app_id.id)])
app_obj.write({'state': 'completed'})
return self.write({'state': 'completed'})
@api.multi
def print_lab_test(self):
return self.env['report'].get_action(self, 'medical_lab_management.report_patient_labtest')
@api.multi
def lab_invoice_create(self):
invoice_obj = self.env["account.invoice"]
invoice_line_obj = self.env["account.invoice.line"]
for lab in self:
if lab.lab_requestor:
curr_invoice = {
'partner_id': lab.lab_requestor.patient.id,
'account_id': lab.lab_requestor.patient.property_account_receivable_id.id,
'state': 'draft',
'type': 'out_invoice',
'date_invoice': datetime.datetime.now(),
'origin': "Lab Test# : " + lab.name,
'target': 'new',
'lab_request': lab.id,
'is_lab_invoice': True
}
inv_ids = invoice_obj.create(curr_invoice)
inv_id = inv_ids.id
if inv_ids:
journal = self.env['account.journal'].search([('type', '=', 'sale')], limit=1)
prd_account_id = journal.default_credit_account_id.id
if lab.test_request:
curr_invoice_line = {
'name': "Charge for lab test",
'price_unit': lab.test_request.test_cost or 0,
'quantity': 1.0,
'account_id': prd_account_id,
'invoice_id': inv_id,
}
invoice_line_obj.create(curr_invoice_line)
self.write({'state': 'invoiced'})
form_view_ref = self.env.ref('account.invoice_form', False)
tree_view_ref = self.env.ref('account.invoice_tree', False)
return {
'domain': "[('id', '=', " + str(inv_id) + ")]",
'name': 'Lab Invoices',
'view_mode': 'form',
'res_model': 'account.invoice',
'type': 'ir.actions.act_window',
'views': [(tree_view_ref.id, 'tree'), (form_view_ref.id, 'form')],
}

24
medical_lab_management/models/lab_test_content_type.py

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Maintainer: Cybrosys Technologies (<https://www.cybrosys.com>)
#
##############################################################################
from odoo import models, fields
class LabTestContentType(models.Model):
_name = 'lab.test.content_type'
_rec_name = 'content_type_name'
_description = "Content"
content_type_name = fields.Char(string="Name", required=True, help="Content type name")
content_type_code = fields.Char(string="Code")
parent_test = fields.Many2one('lab.test', string="Test Category")

31
medical_lab_management/models/lab_test_type.py

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Maintainer: Cybrosys Technologies (<https://www.cybrosys.com>)
#
##############################################################################
from odoo import models, fields
class LabTestType(models.Model):
_name = 'lab.test'
_rec_name = 'lab_test'
_inherit = ['mail.thread', 'ir.needaction_mixin']
lab_test = fields.Char(string="Test Name", required=True, help="Name of lab test ")
lab_test_code = fields.Char(string="Test Code", required=True)
test_lines = fields.One2many('lab.test.attribute', 'test_line_reverse', string="Attribute")
test_cost = fields.Integer(string="Cost", required=True)
class LabTestAttribute(models.Model):
_name = 'lab.test.attribute'
test_content = fields.Many2one('lab.test.content_type', string="Content")
result = fields.Char(string="Result")
unit = fields.Many2one('test.unit', string="Unit")
interval = fields.Char(string="Reference Intervals")
test_line_reverse = fields.Many2one('lab.test', string="Attribute")
test_request_reverse = fields.Many2one('lab.request', string="Request")

22
medical_lab_management/models/physician_speciality.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Maintainer: Cybrosys Technologies (<https://www.cybrosys.com>)
#
##############################################################################
from odoo import models, fields
class PhysicianSpeciality(models.Model):
_name = 'physician.speciality'
_description = 'Medical Specialty'
code = fields.Char(string='ID')
name = fields.Char(string='Specialty', help='Name of the specialty', required=True)
_sql_constraints = [
('name_uniq', 'UNIQUE(name)', 'Name must be unique!'),
]

20
medical_lab_management/models/res_partner.py

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Maintainer: Cybrosys Technologies (<https://www.cybrosys.com>)
#
##############################################################################
from odoo import models, fields
class ResPartnerPatient(models.Model):
_inherit = 'res.partner'
is_patient = fields.Boolean(string='Is Patient')
is_physician = fields.Boolean(string='Is Physician')
speciality = fields.Many2one('physician.speciality', string='Speciality')
hospital = fields.Many2one('res.partner', string='Hospital')

19
medical_lab_management/models/testing_unit.py

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Maintainer: Cybrosys Technologies (<https://www.cybrosys.com>)
#
##############################################################################
from odoo import models, fields
class TestingUnit(models.Model):
_name = 'test.unit'
_rec_name = 'code'
_description = "Test Unit"
unit = fields.Char(string="Unit", required=True)
code = fields.Char(string="code", required=True)

60
medical_lab_management/report/lab_patient_card.xml

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="report_patient_label">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="o">
<div class="page">
<div class="oe_structure"/>
<div class="row">
<div class="col-xs-2" style="margin:auto;">
</div>
<center>
<div class="col-xs-8" style="margin:auto">
<table class="table table-condensed" style="border: 3px solid black !important;">
<tr>
<td width="40%">
<p style="text-align:center;padding-top:10px;">
<img t-if="not o.patient_image" t-att-src="'/web/static/src/img/placeholder.png'" height="120" border="1" width="120"/>
<img t-if="o.patient_image" t-att-src="'data:image/png;base64,%s' %o.patient_image" height="120" border="1" width="120"/>
</p>
<p style="text-align:center;">
<strong><span t-field="o.patient.name"/></strong>
</p>
</td>
<td width="60%">
<table>
<tr>
<td>
<p style="text-align:right;padding-top:30px;"><strong>Patient ID : </strong></p>
<p style="text-align:right;"><strong>Sex : </strong></p>
<p style="text-align:right;"><strong>Age : </strong></p>
</td>
<td>
<p style="text-align:left;padding-top:30px;padding-left:10px;" t-field="o.name"/>
<t t-if="o.gender=='m'">
<p style="text-align:left;padding-left:10px;">Male</p>
</t>
<t t-if="o.gender=='ot'">
<p style="text-align:left;padding-left:10px;">Other</p>
</t>
<t t-if="o.gender=='f'">
<p style="text-align:left;padding-left:10px;">Female</p>
</t>
<p style="text-align:left;padding-left:10px;" t-field="o.age"/>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</center>
</div>
</div>
<p style="page-break-after:always"></p>
</t>
</t>
</template>
</data>
</odoo>

54
medical_lab_management/report/lab_test_report.xml

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_patient_labtest">
<t t-foreach="docs" t-as="o">
<t t-call="report.external_layout">
<div class="page">
<t t-if="o and 'company_id' in o">
<t t-set="company" t-value="o.company_id"> </t>
</t>
<t t-if="not o or not 'company_id' in o">
<t t-set="company" t-value="res_company"> </t>
</t>
<h3 style="text-decoration:underline;text-align:center;"><b>Lab Test Report</b></h3>
<br/>
<br/>
<table width="99%" style="margin-left:50px;margin-top:5px;border: None solid black;">
<tr>
<td style="width:50px;height:25px" ><span>Patient: </span><span t-att-style="style" t-esc="o.lab_requestor.patient.name"/></td>
<td style="width:50px;height:25px" ><span>Test : </span><span t-att-style="style" t-esc="o.test_request.lab_test"/></td>
<td style="width:50px;height:25px" ><span>Date: </span><span t-att-style="style" t-esc="o.lab_requesting_date"/></td>
</tr>
</table>
<br/>
<br/>
<br/>
<br/>
<table width="99%" style="border:1px solid black;padding-left:1.16cm;">
<thead>
<th style="border:1px solid black;text-align:center;" width="13%" class="td4">Content</th>
<th style="border:1px solid black;text-align:center;" width="13%" class="td4">Unit</th>
<th style="border:1px solid black;text-align:center;" width="13%" class="td4">Normal Range</th>
<th style="border:1px solid black;text-align:center;" width="13%" class="td4">Result</th>
</thead>
<tbody>
<t t-foreach="o.request_line" t-as="l">
<tr style="border:1px solid black">
<td style="border:1px solid black;text-align:center;"><span t-esc="l.test_content.content_type_name" style="font-size:16px;"/></td>
<td style="border:1px solid black;text-align:center;"><span t-esc="l.unit.code" style="font-size:16px;"/></td>
<td style="border:1px solid black;text-align:center;"><span t-esc="l.interval" style="font-size:16px;"/></td>
<td style="border:1px solid black;text-align:center;"><span t-esc="l.result" style="font-size:16px;"/></td>
</tr>
</t>
</tbody>
</table>
<br/>
<br/>
</div>
<p style="page-break-after:always"></p>
</t>
</t>
</template>
</data>
</openerp>

23
medical_lab_management/report/report.xml

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<report
string="Lab Test Result"
id="print_lab_test"
model="lab.request"
report_type="qweb-pdf"
name="medical_lab_management.report_patient_labtest"
file="medical_lab_management.report_patient_labtest"
/>
<report
string="Patient Card"
id="action_report_patient_label"
model="lab.patient"
report_type="qweb-pdf"
name="medical_lab_management.report_patient_label"
file="medical_lab_management.report_patient_label"
/>
</data>
</odoo>

19
medical_lab_management/security/ir.model.access.csv

@ -0,0 +1,19 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_lab_request_user,lab.request,model_lab_request,group_lab_management_user,1,1,1,1
access_lab_patient_user,lab.patient,model_lab_patient,group_lab_management_user,1,1,1,1
access_lab_appointment_user,lab.appointment,model_lab_appointment,group_lab_management_user,1,1,1,1
access_test_unit_user,test.unit,model_test_unit,group_lab_management_user,1,0,0,0
access_lab_physician_user,physician.speciality,model_physician_speciality,group_lab_management_user,1,1,1,1
access_lab_test_user,lab.test,model_lab_test,group_lab_management_user,1,0,0,0
access_lab_appointment_line_user,lab.appointment.lines,model_lab_appointment_lines,group_lab_management_user,1,1,1,1
access_lab_test_content_type_user,lab.test.content_type,model_lab_test_content_type,group_lab_management_user,1,0,0,0
access_lab_test_attribute_user,lab.test.attribute,model_lab_test_attribute,group_lab_management_user,1,1,1,1
access_lab_request_technician,lab.request,model_lab_request,group_lab_management_technician,1,1,1,1
access_lab_patient_technician,lab.patient,model_lab_patient,group_lab_management_technician,1,1,1,1
access_lab_appointment_technician,lab.appointment,model_lab_appointment,group_lab_management_technician,1,1,1,1
access_test_unit_technician,test.unit,model_test_unit,group_lab_management_technician,1,1,1,1
access_lab_physician_technician,physician.speciality,model_physician_speciality,group_lab_management_technician,1,0,0,0
access_lab_test_technician,lab.test,model_lab_test,group_lab_management_technician,1,1,1,1
access_lab_test_content_type_technician,lab.test.content_type,model_lab_test_content_type,group_lab_management_technician,1,1,1,1
access_lab_appointment_line_technician,lab.appointment.lines,model_lab_appointment_lines,group_lab_management_technician,1,1,1,1
access_lab_test_attribute_technician,lab.test.attribute,model_lab_test_attribute,group_lab_management_technician,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_lab_request_user lab.request model_lab_request group_lab_management_user 1 1 1 1
3 access_lab_patient_user lab.patient model_lab_patient group_lab_management_user 1 1 1 1
4 access_lab_appointment_user lab.appointment model_lab_appointment group_lab_management_user 1 1 1 1
5 access_test_unit_user test.unit model_test_unit group_lab_management_user 1 0 0 0
6 access_lab_physician_user physician.speciality model_physician_speciality group_lab_management_user 1 1 1 1
7 access_lab_test_user lab.test model_lab_test group_lab_management_user 1 0 0 0
8 access_lab_appointment_line_user lab.appointment.lines model_lab_appointment_lines group_lab_management_user 1 1 1 1
9 access_lab_test_content_type_user lab.test.content_type model_lab_test_content_type group_lab_management_user 1 0 0 0
10 access_lab_test_attribute_user lab.test.attribute model_lab_test_attribute group_lab_management_user 1 1 1 1
11 access_lab_request_technician lab.request model_lab_request group_lab_management_technician 1 1 1 1
12 access_lab_patient_technician lab.patient model_lab_patient group_lab_management_technician 1 1 1 1
13 access_lab_appointment_technician lab.appointment model_lab_appointment group_lab_management_technician 1 1 1 1
14 access_test_unit_technician test.unit model_test_unit group_lab_management_technician 1 1 1 1
15 access_lab_physician_technician physician.speciality model_physician_speciality group_lab_management_technician 1 0 0 0
16 access_lab_test_technician lab.test model_lab_test group_lab_management_technician 1 1 1 1
17 access_lab_test_content_type_technician lab.test.content_type model_lab_test_content_type group_lab_management_technician 1 1 1 1
18 access_lab_appointment_line_technician lab.appointment.lines model_lab_appointment_lines group_lab_management_technician 1 1 1 1
19 access_lab_test_attribute_technician lab.test.attribute model_lab_test_attribute group_lab_management_technician 1 1 1 1

17
medical_lab_management/security/lab_users.xml

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.module.category" id="module_category_lab_management">
<field name="name">Lab Management</field>
</record>
<record id="group_lab_management_technician" model="res.groups">
<field name="name">Lab Technician</field>
<field name="category_id" ref="module_category_lab_management"/>
</record>
<record id="group_lab_management_user" model="res.groups">
<field name="name">Lab User</field>
<field name="category_id" ref="module_category_lab_management"/>
</record>
</odoo>

BIN
medical_lab_management/static/description/app.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
medical_lab_management/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

BIN
medical_lab_management/static/description/card.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
medical_lab_management/static/description/content.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

BIN
medical_lab_management/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
medical_lab_management/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

270
medical_lab_management/static/description/index.html

@ -0,0 +1,270 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan">Medical Lab Management</h2>
<h3 class="oe_slogan">Manage Lab Activities</h3>
<h4 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a> </h4>
</div>
<div class="oe_row oe_spaced" style="padding-left:65px;">
<h4>Features:</h4>
<div>
<span style="color:green;"> &#9745; </span> Manage Patients.<br/>
<span style="color:green;"> &#9745; </span> Issue Patient Card.<br/>
<span style="color:green;"> &#9745; </span> Manage Referrals of Patients.<br/>
<span style="color:green;"> &#9745; </span> Manage Appointments.<br/>
<span style="color:green;"> &#9745; </span> Mail Notification For Appointments.<br/>
<span style="color:green;"> &#9745; </span> Manage Lab Requests.<br/>
<span style="color:green;"> &#9745; </span> Print Lab Test Result Of Patient.<br/>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_picture">
<h3 class="oe_slogan">Overview</h3>
<p class="oe_mt32 text-justify" style="text-align: center;">
This app helps the user to systematically perform the activities of a Medical Laboratory.
The app simplifies the activities like Patient Management, Appointment Management, Test Requests Management, Lab Results Management, and so on.
</p>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div style="text-align: center">
<p>
<h3>Patients</h3>
<p>
</div>
<div style="text-align: center">
<span class="oe_mt32 text-justify" style="text-align: center;">Create patients.</span>
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="patient.png">
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div style="text-align: center">
<p>
<h3>Patient Card</h3>
</p>
</div>
<div class="" style="text-align: center">
<span class="oe_mt32 text-justify" style="text-align: center;">Go to Laboratory -> Patient -> Print -> Patient Card.</span>
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="card.png">
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div style="text-align: center">
<p>
<h3>Appointments</h3>
</p>
</div>
<div class="" style="text-align: center">
<span>Go to Laboratory -> Appointments->Create Appointments.</span>
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="app.png">
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div style="text-align: center">
<p>
<h3>Mail Notification on Appointment</h3>
</p>
</div>
<div class="" style="text-align: center">
<span>When we confirm the appointment the appointment details will be sent through E-Mail.
</span>
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="mail.png">
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div style="text-align: center">
<p>
<h3>Lab Request</h3>
</p>
</div>
<div class="" style="text-align: center">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="request2.png">
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div style="text-align: center">
<p>
<h3>Lab Test Result</h3>
</p>
</div>
<div class="" style="text-align: center">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="result.png">
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div style="text-align: center">
<p>
<h3>Lab Test Invoice</h3>
</p>
</div>
<div class="" style="text-align: center">
<span>Create invoice for lab test.</span>
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="invoice.png">
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div style="text-align: center">
<p>
<h3>Today's Appointments</h3>
</p>
</div>
<div class="" style="text-align: center">
<span>You can see today's appointments here.</span>
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="today.png">
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div style="text-align: center">
<p>
<h3>Lab Test</h3>
</p>
</div>
<div class="" style="text-align: center">
<span class="oe_mt32 text-justify" style="text-align: center;">Go to Laboratory -> Configuration -> Lab test.</span>
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="test.png">
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div style="text-align: center">
<p>
<h3>Test Contents</h3>
</p>
</div>
<div class="" style="text-align: center">
<span>Go to Laboratory -> Configuration -> Test Contents.</span>
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="content.png">
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div style="text-align: center">
<p>
<h3>Lab Test Units</h3>
</p>
</div>
<div class="" style="text-align: center">
<span class="oe_mt32 text-justify" style="text-align: center;">Go to Laboratory -> Configuration -> Testing Unit.</span>
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="unit.png">
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div style="text-align: center">
<p>
<h3>Referrals Details</h3>
</p>
</div>
<div class="" style="text-align: center">
<span>We can add referral physician details.</span>
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="phy.png">
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div style="text-align: center">
<p>
<h3>Users</h3>
</p>
</div>
<div class="" style="text-align: center">
<span>There are two type users.</span>
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="user.png">
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2>
<div class="oe_slogan" style="margin-top:10px !important;">
<div>
<a class="btn btn-primary btn-lg mt8"
style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com"><i
class="fa fa-envelope"></i> Email </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/contact/"><i
class="fa fa-phone"></i> Contact Us </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/odoo-customization-and-installation/"><i
class="fa fa-check-square"></i> Request Customization </a>
</div>
<br>
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block">
<div>
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td>
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td>
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td>
</div>
</div>
</section>

BIN
medical_lab_management/static/description/invoice.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

BIN
medical_lab_management/static/description/mail.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
medical_lab_management/static/description/patient.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

BIN
medical_lab_management/static/description/phy.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
medical_lab_management/static/description/request1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
medical_lab_management/static/description/request2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

BIN
medical_lab_management/static/description/result.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
medical_lab_management/static/description/test.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
medical_lab_management/static/description/today.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
medical_lab_management/static/description/unit.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
medical_lab_management/static/description/user.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

30
medical_lab_management/views/account_invoice.xml

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="lab_invoice_cust_invoice_view" model="ir.ui.view">
<field name="name">account.invoice.cust.invoice_form</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='date_invoice']" position="after">
<field name="is_lab_invoice" invisible="1"/>
<field name="lab_request" />
</xpath>
</field>
</record>
<record id="lab_invoice_cust_invoice_filter_view" model="ir.ui.view">
<field name="name">account.invoice.cust.invoice_filter_form</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.view_account_invoice_filter"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='user_id']" position="after">
<field name="lab_request"/>
</xpath>
<xpath expr="//group/filter[@name='status']" position="after">
<filter string="Appointment" domain="[]" context="{'group_by':'lab_request'}"/>
</xpath>
</field>
</record>
</data>
</odoo>

232
medical_lab_management/views/lab_appointment.xml

@ -0,0 +1,232 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record model="ir.actions.act_window" id="lab_invoice_action">
<field name="name">Invoices</field>
<field name="res_model">account.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,kanban,calendar,graph,pivot</field>
<field name="view_id" ref="account.invoice_tree"/>
<field name="domain">[('is_lab_invoice','=',True)]</field>
<field name="search_view_id" ref="account.view_account_invoice_filter"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Create Invoices.
</p>
</field>
</record>
<record id="lab_invoice_action_view_tree" model="ir.actions.act_window.view">
<field name="sequence">1</field>
<field name="view_mode">tree</field>
<field name="act_window_id" ref="medical_lab_management.lab_invoice_action"/>
</record>
<record id="lab_invoice_view_form" model="ir.actions.act_window.view">
<field name="sequence">2</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account.invoice_form"/>
<field name="act_window_id" ref="medical_lab_management.lab_invoice_action"/>
</record>
<record model="ir.ui.view" id="kanban_view_lab_appointment">
<field name="name">Appointment Kanban</field>
<field name="model">lab.appointment</field>
<field name="arch" type="xml">
<kanban>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div class="oe_kanban_details">
<strong>
<ul>
<li>Name :<field name="patient_id"/></li>
<li>Lab Request ID :<field name="name"/></li>
<li>Appointment Date :<field name="appointment_date"/></li>
</ul>
</strong>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record id="view_lab_appointment_tree" model="ir.ui.view">
<field name="name">lab.appointment.tree</field>
<field name="model">lab.appointment</field>
<field name="priority" eval="8" />
<field name="arch" type="xml">
<tree string="Appointments" colors="blue:state in ('sample_collection','test_in_progress');black:state == 'draft';gray:state in ('invoiced','cancelled');green:state == 'completed'">
<field name="patient_id" />
<field name="name" />
<field name="state" />
</tree>
</field>
</record>
<record id="view_lab_appointment_form" model="ir.ui.view">
<field name="name">lab.appointment.form</field>
<field name="model">lab.appointment</field>
<field name="priority" eval="8" />
<field name="arch" type="xml">
<form string="Appointment">
<header>
<button name="confirm_appointment" states="draft" string="Confirm" type="object" class="oe_highlight" />
<button name="action_request" states="draft,confirm" string="Request Lab" type="object" class="oe_highlight" />
<button name="create_invoice" states="completed" string="Create Invoice" type="object"/>
<button name="cancel_appointment" states="draft,confirm" string="Cancelled" type="object"/>
<field name="state" widget="statusbar" statusbar_visible="draft,confirm,request_lab,completed,to_invoice,invoiced"
/>
</header>
<sheet>
<div class="oe_button_box" name="button_box">
<button name="%(act_open_lab_request_view)d"
type="action"
class="oe_stat_button"
icon="fa-building-o"
context = "{'search_default_app_id': [active_id]}"
attrs="{'invisible': [('request_count', '=', 0)]}">
<field name="request_count" widget="statinfo" string="Lab Requests"/>
</button>
<button name="%(lab_invoice_action)d"
type="action"
class="oe_stat_button"
icon="fa-pencil-square-o"
context = "{'search_default_lab_request': [active_id]}"
attrs="{'invisible': [('inv_count', '=', 0)]}">
<field name="inv_count" widget="statinfo" string="Lab Invoice"/>
</button>
</div>
<group>
<group col="4" colspan="4">
<field name="patient_id" />
<field name="priority" widget="priority"/>
<field name="name" />
<field name="date" />
<field name="appointment_date" />
<field name="physician_id" domain="[('is_physician','=',True)]" context="{'search_default_is_physician':1, 'default_is_physician':1}"/>
</group>
</group>
<notebook colspan="4">
<page string="Lab Requests">
<field name="appointment_lines">
<tree string="Lab Request" editable="bottom">
<field name="lab_test"/>
<field name="cost"/>
</tree>
</field>
</page>
<page name="Note"
string="Note">
<field name="comment"/>
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
</record>
<record id="view_lab_appointment_search" model="ir.ui.view">
<field name="name">lab.appointment.search</field>
<field name="model">lab.appointment</field>
<field name="priority" eval="8" />
<field name="arch" type="xml">
<search string="Appointment">
<field name="patient_id" />
<field name="date" />
<field name="name" />
<field name="physician_id" />
<newline />
<group expand="0" string="Group By...">
<filter name="patient_id" string="Patient"
domain="[]" context="{'group_by':'patient_id'}" />
<filter name="date" string="Date"
domain="[]" context="{'group_by':'date'}" />
<filter name="appointment_date" string="Appointment date"
domain="[]" context="{'group_by':'appointment_date'}" />
<filter name="physician_id" string="Physician"
domain="[]" context="{'group_by':'physician_id'}" />
</group>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="act_open_lab_appointment_view">
<field name="name">Appointments</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">lab.appointment</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,kanban</field>
<field name="search_view_id" ref="view_lab_appointment_search" />
<field name="domain">[]</field>
<field name="context">{}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Create Appointments.
</p>
</field>
</record>
<record model="ir.actions.act_window" id="act_open_lab_appointment_view_2">
<field name="name">Appointments</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">lab.appointment</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_lab_appointment_search" />
<field name="domain">[('appointment_date', '&gt;=',((datetime.date.today()- datetime.timedelta(days=0)).strftime('%Y-%m-%d 00:00:00'))),
('appointment_date', '&lt;=',((datetime.date.today()- datetime.timedelta(days=0)).strftime('%Y-%m-%d 23:59:59')))]
</field>
<field name="context">{}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Create Appointments.
</p>
</field>
</record>
<record model="ir.sequence" id="seq_lab_appointment">
<field name="name">Appointment </field>
<field name="code">lab.appointment</field>
<field name="prefix">ID</field>
<field name="padding">3</field>
<field name="company_id" eval="False" />
</record>
<menuitem id="menu_lab_appointment" name="Appointments" sequence="11"
parent="menu_root_lab"/>
<menuitem id="menu_lab_appointment_child" name="Appointments" sequence="10"
parent="menu_lab_appointment" action="act_open_lab_appointment_view"/>
<menuitem id="menu_lab_appointment_child_2" name=" Today's Appointments" sequence="11"
parent="menu_lab_appointment" action="act_open_lab_appointment_view_2"/>
<record id="view_lab_patient_form_inherit" model="ir.ui.view">
<field name="name">lab.patient.form</field>
<field name="model">lab.patient</field>
<field name="inherit_id" ref="medical_lab_management.view_lab_patient_form" />
<field name="arch" type="xml">
<data>
<xpath expr="//div[@name='button_box']" position="inside">
<button name="%(act_open_lab_appointment_view)d"
type="action"
class="oe_stat_button"
icon="fa-building-o"
context = "{'search_default_patient_id': [active_id], 'default_patient_id':[active_id]}" >
<field name="app_count" widget="statinfo" string="Appointments"/>
</button>
</xpath>
</data>
</field>
</record>
</data>
</odoo>

157
medical_lab_management/views/lab_patient_view.xml

@ -0,0 +1,157 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<menuitem id="menu_root_lab" name="Laboratory" sequence="40"/>
<record model="ir.ui.view" id="kanban_view_patient">
<field name="name">Patient Kanban</field>
<field name="model">lab.patient</field>
<field name="arch" type="xml">
<kanban>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div class="o_kanban_image">
<img t-att-src="kanban_image('lab.patient', 'patient_image', record.id.value)"/>
</div>
<div class="oe_kanban_details">
<strong>
<ul>
<li>Name :<field name="patient"/></li>
<li>Patient ID :<field name="name"/></li>
</ul>
</strong>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record id="view_lab_patient_tree" model="ir.ui.view">
<field name="name">lab.patient.tree</field>
<field name="model">lab.patient</field>
<field name="priority" eval="8" />
<field name="arch" type="xml">
<tree string="Patient">
<field name="title" />
<field name="patient" />
<field name="name" />
<field name="phone"/>
<field name="email"/>
</tree>
</field>
</record>
<record id="view_lab_patient_form" model="ir.ui.view">
<field name="name">lab.patient.form</field>
<field name="model">lab.patient</field>
<field name="priority" eval="8" />
<field name="arch" type="xml">
<form string="Patient">
<sheet>
<div class="oe_button_box" name="button_box">
</div>
<field name="patient_image" widget="image" class="oe_avatar"/>
<div name="title_name" class="oe_title">
<h3>
<field name="title"
style="width: 30%%" />
</h3>
<h1>
<table>
<tr>
<td>
<field name="patient"
required="1"
placeholder="FullName"
style="padding-right:10px"
domain="[('is_patient','=',True)]" context="{'search_default_is_patient':1, 'default_is_patient':1, 'default_customer':1}"
/>
</td>
</tr>
</table>
</h1>
</div>
<group>
<group>
<field name="name" />
<field name="gender" />
<field name="dob" />
<field name="age"/>
<field name="phone"/>
</group>
<group>
<field name="visa_info"/>
<field name="id_proof_number"/>
<field name="date" invisible="1"/>
<field name="blood_group"/>
<field name="email"/>
</group>
</group>
<notebook>
<page string="Note">
<group>
<field name="note"/>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="view_lab_patient_search" model="ir.ui.view">
<field name="name">lab.patient.search</field>
<field name="model">lab.patient</field>
<field name="priority" eval="8" />
<field name="arch" type="xml">
<search string="Patient">
<field name="patient" />
<field name="blood_group" />
<field name="name" />
<newline />
<group expand="0" string="Group By...">
<filter name="blood_group" string="Blood Group"
domain="[]" context="{'group_by':'blood_group'}" />
<filter name="name" string="Patient ID"
domain="[]" context="{'group_by':'name'}" />
<filter name="patient" string="Patient"
domain="[]" context="{'group_by':'patient'}" />
</group>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="act_open_lab_patient_view">
<field name="name">Patients</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">lab.patient</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="search_view_id" ref="view_lab_patient_search" />
<field name="domain">[]</field>
<field name="context">{}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Create Patients.
</p>
</field>
</record>
<record model="ir.sequence" id="seq_lab_patient">
<field name="name">Patient</field>
<field name="code">lab.patient</field>
<field name="prefix">PID</field>
<field name="padding">3</field>
<field name="company_id" eval="False" />
</record>
<menuitem id="menu_lab_patient" name="Patient" sequence="10"
parent="menu_root_lab"/>
<menuitem id="menu_lab_patient_child" name="Patient" sequence="10"
parent="menu_lab_patient" action="act_open_lab_patient_view"/>
</data>
</odoo>

121
medical_lab_management/views/lab_request.xml

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record id="view_lab_request_tree" model="ir.ui.view">
<field name="name">lab.request.tree</field>
<field name="model">lab.request</field>
<field name="arch" type="xml">
<tree string="Lab Request" colors="green:state in ('sample_collection','test_in_progress');black:state == 'completed';gray:state == 'cancelled';blue:state == 'draft'">
<field name="name" />
<field name="lab_requestor" />
<field name="lab_request_id" />
<field name="test_request" />
<field name="state" />
</tree>
</field>
</record>
<record id="view_lab_reques_form" model="ir.ui.view">
<field name="name">lab.request.form</field>
<field name="model">lab.request</field>
<field name="arch" type="xml">
<form string="Lab Request">
<header>
<header>
<button name="set_to_sample_collection" states="draft" string="Sample Collection" type="object"/>
<button name="set_to_test_in_progress" states="sample_collection" string="Test In Progress" type="object" class="oe_highlight"/>
<button name="set_to_test_completed" states="test_in_progress" string="Complete Test" type="object"/>
<button name="print_lab_test" states="completed,invoiced" string="Print Lab Test" type="object"/>
<button name="cancel_lab_test" states="draft" string="Cancel" type="object"/>
<field name="state" widget="statusbar" statusbar_visible="draft,sample_collection,test_in_progress,completed,cancel" statusbar_colors='{"Completed":"blue","Test In Progress":"red","Invoiced":"grey"}'/>
</header>
</header>
<sheet>
<div class="oe_left" style="width: 500px;">
<div class="oe_title" style="width: 390px;">
<label class="oe_edit_only" for="name"/>
<h1><field name="name" class="oe_inline"/></h1>
</div>
</div>
<group>
<group col="4" colspan="4">
<field name="lab_requestor" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
<field name="lab_request_id"/>
<field name="lab_requesting_date" />
<field name="test_request"/>
<field name="app_id" invisible="1"/>
</group>
</group>
<notebook colspan="4">
<page string="Test lines">
<field name="request_line">
<tree string="Test lines" editable="bottom">
<field name="test_content" />
<field name="unit"/>
<field name="interval"/>
<field name="result"/>
</tree>
</field>
</page>
<page name="Note"
string="Note">
<field name="comment"/>
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
</record>
<record id="view_lab_requester_search" model="ir.ui.view">
<field name="name">lab.request.search</field>
<field name="model">lab.request</field>
<field name="priority" eval="8" />
<field name="arch" type="xml">
<search string="Lab Request">
<field name="lab_requestor" />
<field name="lab_request_id" />
<field name="app_id" />
<newline />
<group expand="0" string="Group By...">
<filter name="lab_requestor" string="Patient"
domain="[]" context="{'group_by':'lab_requestor'}" />
<filter name="lab_request_id" string="Date"
domain="[]" context="{'group_by':'lab_request_id'}" />
</group>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="act_open_lab_request_view">
<field name="name">Lab Request</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">lab.request</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_lab_requester_search" />
<field name="domain">[]</field>
<field name="context">{}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Create Lab request.
</p>
</field>
</record>
<record model="ir.sequence" id="seq_lab_request">
<field name="name">Lab Request</field>
<field name="code">lab.request</field>
<field name="prefix">LR</field>
<field name="padding">3</field>
<field name="company_id" eval="False" />
</record>
<menuitem id="menu_lab_request" name="Lab Request" sequence="12"
parent="menu_root_lab"/>
<menuitem id="menu_lab_request_child" name="Lab Request" sequence="10"
parent="menu_lab_request" action="act_open_lab_request_view"/>
</data>
</odoo>

72
medical_lab_management/views/lab_test_content_type.xml

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record id="view_lab_content_tree" model="ir.ui.view">
<field name="name">lab.test.content_type.tree</field>
<field name="model">lab.test.content_type</field>
<field name="priority" eval="8" />
<field name="arch" type="xml">
<tree string="Contents">
<field name="content_type_name" />
<field name="content_type_code" />
</tree>
</field>
</record>
<record id="view_lab_content_form" model="ir.ui.view">
<field name="name">lab.test.content_type.form</field>
<field name="model">lab.test.content_type</field>
<field name="priority" eval="8" />
<field name="arch" type="xml">
<form string="Contents">
<sheet>
<group>
<group col="4" colspan="4">
<field name="content_type_name" />
<field name="content_type_code" />
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="view_lab_content_search" model="ir.ui.view">
<field name="name">lab.test.content_type.search</field>
<field name="model">lab.test.content_type</field>
<field name="priority" eval="8" />
<field name="arch" type="xml">
<search string="Test Content">
<field name="content_type_name" />
<field name="content_type_code" />
<newline />
<group expand="0" string="Group By...">
<filter name="content_type_name" string="Content"
domain="[]" context="{'group_by':'content_type_name'}" />
<filter name="content_type_code" string="Content Code"
domain="[]" context="{'group_by':'content_type_code'}" />
</group>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="act_open_lab_content_view">
<field name="name">Test Contents</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">lab.test.content_type</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[]</field>
<field name="search_view_id" ref="view_lab_content_search" />
<field name="context">{}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Create Test Contents.
</p>
</field>
</record>
<menuitem id="menu_lab_content" name="Test Content" sequence="10"
parent="configuration_id" action="act_open_lab_content_view"/>
</data>
</odoo>

102
medical_lab_management/views/lab_test_type.xml

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record id="view_lab_test_tree" model="ir.ui.view">
<field name="name">lab.test.tree</field>
<field name="model">lab.test</field>
<field name="priority" eval="8" />
<field name="arch" type="xml">
<tree string="Lab Test">
<field name="lab_test" />
<field name="lab_test_code" />
<field name="test_cost" />
</tree>
</field>
</record>
<record id="view_lab_test_form" model="ir.ui.view">
<field name="name">lab.test.form</field>
<field name="model">lab.test</field>
<field name="priority" eval="8" />
<field name="arch" type="xml">
<form string="Lab Test">
<sheet>
<group>
<group col="4" colspan="4">
<field name="lab_test" />
<field name="lab_test_code"/>
<field name="test_cost" />
</group>
</group>
<notebook>
<page string="Lab Test Type" style="overflow-x:scroll;">
<group>
<field name="test_lines" nolabel="1">
<tree string="Lab Test Type" editable="bottom">
<field name="test_content" />
<field name="unit"/>
<field name="interval"/>
</tree>
</field>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="view_lab_test_search" model="ir.ui.view">
<field name="name">lab.test.search</field>
<field name="model">lab.test</field>
<field name="priority" eval="8" />
<field name="arch" type="xml">
<search string="Lab Test">
<field name="lab_test" />
<newline />
<group expand="0" string="Group By...">
<filter name="lab_test" string="Test"
domain="[]" context="{'group_by':'lab_test'}" />
</group>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="act_open_lab_test_view">
<field name="name">Lab Test</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">lab.test</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_lab_test_search" />
<field name="domain">[]</field>
<field name="context">{}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Create Lab Tests.
</p>
</field>
</record>
<menuitem id="menu_lab_test" name="Lab Test" sequence="1"
parent="configuration_id" action="act_open_lab_test_view"/>
<record id="view_lab_test_attribute_form" model="ir.ui.view">
<field name="name">lab.test.attribute.form</field>
<field name="model">lab.test.attribute</field>
<field name="priority" eval="8" />
<field name="arch" type="xml">
<form string="Lab Test Type Attribute">
<group>
<group col="4" colspan="4">
<field name="test_content" />
<field name="result"/>
<field name="unit" />
<field name="interval"/>
</group>
</group>
</form>
</field>
</record>
</data>
</odoo>

25
medical_lab_management/views/physician_details.xml

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record model="ir.actions.act_window" id="action_physician">
<field name="name">Physician</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('is_physician','=',1)]</field>
<field name="context">{'default_customer':0, 'default_supplier':0 , 'default_is_physician':1}</field>
<field name="filter" eval="True"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to add physician.
</p>
</field>
</record>
<menuitem id="menu_physician" name="Referrals From" sequence="18"
parent="menu_root_lab"/>
<menuitem id="menu_physician_child" name="Physician" sequence="1"
parent="menu_physician" action="action_physician"/>
</data>
</odoo>

18
medical_lab_management/views/physician_specialty.xml

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="physician_speciality_view_form" model="ir.ui.view">
<field name="name">physician.speciality.form</field>
<field name="model">physician.speciality</field>
<field name="priority" eval="8" />
<field name="arch" type="xml">
<form string="Specialty">
<group>
<field name="code" />
<field name="name" />
</group>
</form>
</field>
</record>
</data>
</odoo>

22
medical_lab_management/views/res_partner.xml

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record id="view_res_partner_inherit" model="ir.ui.view">
<field name="name">res.partner.form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="Lab" groups="base.group_user">
<group>
<field name="is_patient"/>
<field name="is_physician"/>
<field name="speciality" attrs="{'invisible': [('is_physician', '=', False)]}"/>
<field name="hospital" attrs="{'invisible': [('is_physician', '=', False)]}"/>
</group>
</page>
</notebook>
</field>
</record>
</data>
</odoo>

72
medical_lab_management/views/test_unit_view.xml

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record id="view_test_unit_tree" model="ir.ui.view">
<field name="name">test.unit.tree</field>
<field name="model">test.unit</field>
<field name="priority" eval="8" />
<field name="arch" type="xml">
<tree string="Test Unit">
<field name="unit" />
<field name="code" />
</tree>
</field>
</record>
<record id="view_test_unit_form" model="ir.ui.view">
<field name="name">test.unit.form</field>
<field name="model">test.unit</field>
<field name="priority" eval="8" />
<field name="arch" type="xml">
<form string="Test Unit">
<sheet>
<group>
<group>
<field name="unit" />
</group>
<group>
<field name="code" />
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="view_test_unit_search" model="ir.ui.view">
<field name="name">test.unit.search</field>
<field name="model">test.unit</field>
<field name="priority" eval="8" />
<field name="arch" type="xml">
<search string="Testing Unit">
<field name="unit" />
<group expand="0" string="Group By...">
<filter name="unit" string="Blood Group"></filter>
</group>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="act_open_test_unit_view">
<field name="name">Testing Units</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">test.unit</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_test_unit_search" />
<field name="domain">[]</field>
<field name="context">{}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Create Testing Units.
</p>
</field>
</record>
<menuitem id="configuration_id"
name="Configuration"
parent="menu_root_lab"
sequence="100"/>
<menuitem name="Testing Unit"
id="test_unit_conf"
parent="configuration_id"
action="act_open_test_unit_view"
sequence="20" />
</data>
</odoo>
Loading…
Cancel
Save