Merge branch 'develop' into refactor-lab-module

This commit is contained in:
Rucha Mahabal
2020-08-31 09:50:30 +05:30
committed by GitHub
270 changed files with 5285 additions and 4162 deletions

View File

@@ -7,6 +7,8 @@ import unittest
import frappe
from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import create_healthcare_docs, create_clinical_procedure_template
test_dependencies = ['Item']
class TestClinicalProcedure(unittest.TestCase):
def test_procedure_template_item(self):
patient, medical_department, practitioner = create_healthcare_docs()

View File

@@ -71,6 +71,7 @@ def validate_service_item(item, msg):
frappe.throw(_(msg))
@frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs
def get_practitioner_list(doctype, txt, searchfield, start, page_len, filters=None):
fields = ['name', 'practitioner_name', 'mobile_phone']

View File

@@ -39,7 +39,9 @@ class HealthcareServiceUnitType(Document):
def on_trash(self):
if self.item:
try:
frappe.delete_doc('Item', self.item)
item = self.item
self.db_set('item', '')
frappe.delete_doc('Item', item)
except Exception:
frappe.throw(_('Not permitted. Please disable the Service Unit Type'))

View File

@@ -134,7 +134,7 @@ let transfer_patient_dialog = function(frm) {
{fieldtype: 'Link', label: 'Leave From', fieldname: 'leave_from', options: 'Healthcare Service Unit', reqd: 1, read_only:1},
{fieldtype: 'Link', label: 'Service Unit Type', fieldname: 'service_unit_type', options: 'Healthcare Service Unit Type'},
{fieldtype: 'Link', label: 'Transfer To', fieldname: 'service_unit', options: 'Healthcare Service Unit', reqd: 1},
{fieldtype: 'Datetime', label: 'Check In', fieldname: 'check_in', reqd: 1}
{fieldtype: 'Datetime', label: 'Check In', fieldname: 'check_in', reqd: 1, default: frappe.datetime.now_datetime()}
],
primary_action_label: __('Transfer'),
primary_action : function() {
@@ -147,7 +147,12 @@ let transfer_patient_dialog = function(frm) {
if(dialog.get_value('service_unit')){
service_unit = dialog.get_value('service_unit');
}
if(!check_in){
if(check_in > frappe.datetime.now_datetime()){
frappe.msgprint({
title: __('Not Allowed'),
message: __('Check-in time cannot be greater than the current time'),
indicator: 'red'
});
return;
}
frappe.call({

View File

@@ -5,7 +5,7 @@
from __future__ import unicode_literals
import frappe, json
from frappe import _
from frappe.utils import today, now_datetime, getdate
from frappe.utils import today, now_datetime, getdate, get_datetime
from frappe.model.document import Document
from frappe.desk.reportview import get_match_cond
@@ -30,6 +30,11 @@ class InpatientRecord(Document):
(getdate(self.discharge_ordered_date) < getdate(self.scheduled_date)):
frappe.throw(_('Expected and Discharge dates cannot be less than Admission Schedule date'))
for entry in self.inpatient_occupancies:
if entry.check_in and entry.check_out and \
get_datetime(entry.check_in) > get_datetime(entry.check_out):
frappe.throw(_('Row #{0}: Check Out datetime cannot be less than Check In datetime').format(entry.idx))
def validate_already_scheduled_or_admitted(self):
query = """
select name, status
@@ -217,6 +222,7 @@ def patient_leave_service_unit(inpatient_record, check_out, leave_from):
inpatient_record.save(ignore_permissions = True)
@frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs
def get_leave_from(doctype, txt, searchfield, start, page_len, filters):
docname = filters['docname']

View File

@@ -226,7 +226,9 @@ let check_and_set_availability = function(frm) {
primary_action_label: __('Book'),
primary_action: function() {
frm.set_value('appointment_time', selected_slot);
frm.set_value('duration', duration);
if (!frm.doc.duration) {
frm.set_value('duration', duration);
}
frm.set_value('practitioner', d.get_value('practitioner'));
frm.set_value('department', d.get_value('department'));
frm.set_value('appointment_date', d.get_value('appointment_date'));