fix: codacy

This commit is contained in:
Rucha Mahabal 2020-03-26 17:29:50 +05:30
parent 42376705ab
commit 197165ff40
20 changed files with 42 additions and 53 deletions

View File

@ -40,8 +40,7 @@
"charts": [
{
"chart_name": "Patient Appointments",
"label": "Patient Appointments",
"size": "Full"
"label": "Patient Appointments"
}
],
"charts_label": "",
@ -54,7 +53,7 @@
"idx": 0,
"is_standard": 1,
"label": "Healthcare",
"modified": "2020-03-12 16:30:36.952979",
"modified": "2020-03-26 16:10:44.629795",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Healthcare",
@ -81,7 +80,7 @@
"format": "{} Vacant",
"is_query_report": 0,
"link_to": "Healthcare Service Unit",
"stats_filter": "{\n \"occupancy_status\": \"Vacant\"\n}",
"stats_filter": "{\n \"occupancy_status\": \"Vacant\",\n \"is_group\": 0\n}",
"type": "DocType"
},
{

View File

@ -84,7 +84,7 @@ frappe.ui.form.on('Clinical Procedure', {
if (r.message) {
frappe.show_alert({
message: __('Stock Entry {0} created',
['<a class="bold" href="#Form/Stock Entry/'+ r.message + '">' + r.message + '</a>']),
['<a class="bold" href="#Form/Stock Entry/'+ r.message + '">' + r.message + '</a>']),
indicator: 'green'
});
frm.reload_doc();
@ -261,7 +261,7 @@ frappe.ui.form.on('Clinical Procedure', {
},
callback: function(data) {
if (data.message) {
frm.doc.items = []
frm.doc.items = [];
$.each(data.message, function(i, v) {
let item = frm.add_child('items');
item.item_code = v.item_code;

View File

@ -6,7 +6,7 @@ from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import cint, flt, nowdate, nowtime, cstr
from frappe.utils import flt, nowdate, nowtime, cstr
from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_account
from erpnext.healthcare.doctype.lab_test.lab_test import create_sample_doc
from erpnext.stock.stock_ledger import get_previous_sle

View File

@ -2,9 +2,9 @@ frappe.listview_settings['Clinical Procedure'] = {
get_indicator: function(doc) {
var colors = {
'Completed': 'green',
'In Progress': 'orange',
'Pending': 'orange',
'Cancelled': 'grey'
'In Progress': 'orange',
'Pending': 'orange',
'Cancelled': 'grey'
};
return [__(doc.status), colors[doc.status], 'status,=,' + doc.status];
}

View File

@ -5,7 +5,6 @@ from __future__ import unicode_literals
import unittest
import frappe
from frappe.utils import nowdate
from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import create_healthcare_docs, create_clinical_procedure_template
class TestClinicalProcedure(unittest.TestCase):
@ -33,7 +32,7 @@ class TestClinicalProcedure(unittest.TestCase):
procedure = create_procedure(procedure_template, patient, practitioner)
result = procedure.start_procedure()
if result == 'insufficient stock':
material_receipt = procedure.make_material_receipt(submit=True)
procedure.make_material_receipt(submit=True)
result = procedure.start_procedure()
self.assertEqual(procedure.status, 'In Progress')
result = procedure.complete_procedure()

View File

@ -7,7 +7,6 @@ import frappe, json
from frappe import _
from frappe.model.document import Document
from frappe.model.rename_doc import rename_doc
from frappe.utils import nowdate
class ClinicalProcedureTemplate(Document):
def validate(self):

View File

@ -14,8 +14,6 @@ class FeeValidity(Document):
self.set_start_date()
def update_status(self):
valid_till = getdate(self.valid_till)
start_date = getdate(self.start_date)
if self.visited >= self.max_visits:
self.status = 'Completed'
else:

View File

@ -5,8 +5,7 @@ from __future__ import unicode_literals
import frappe
import unittest
from frappe.utils.make_random import get_random
from frappe.utils import nowdate, add_days, getdate
from frappe.utils import nowdate, add_days
from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import create_healthcare_docs, create_appointment
test_dependencies = ["Company"]

View File

@ -5,8 +5,7 @@
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import throw, _
from frappe.utils import cstr
from frappe import _
from erpnext.accounts.party import validate_party_accounts
from frappe.contacts.address_and_contact import load_address_and_contact, delete_contact_and_address
from frappe.model.naming import append_number_if_name_exists

View File

@ -9,6 +9,7 @@
"doctype": "DocType",
"document_type": "Setup",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"healthcare_service_unit_name",
"parent_healthcare_service_unit",
@ -100,7 +101,7 @@
"fieldtype": "Select",
"label": "Occupancy Status",
"no_copy": 1,
"options": "Vacant\nOccupied",
"options": "\nVacant\nOccupied",
"read_only": 1
},
{
@ -158,13 +159,11 @@
"report_hide": 1
}
],
"is_tree": 1,
"links": [],
"modified": "2020-01-30 18:03:29.031351",
"modified": "2020-03-26 16:13:08.675952",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Healthcare Service Unit",
"nsm_parent_field": "parent_healthcare_service_unit",
"owner": "Administrator",
"permissions": [
{

View File

@ -49,7 +49,8 @@ class HealthcareServiceUnitType(Document):
def item_price_exists(doc):
if frappe.db.exists({'doctype': 'Item Price', 'item_code': doc.item_code}):
item_price = frappe.db.exists({'doctype': 'Item Price', 'item_code': doc.item_code})
if len(item_price):
return item_price[0][0]
return False

View File

@ -6,7 +6,7 @@ from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import cint, cstr, getdate, flt
from frappe.utils import cint, cstr, getdate
import dateutil
from frappe.model.naming import set_name_by_naming_series
from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_receivable_account, get_income_account, send_registration_sms

View File

@ -6,7 +6,7 @@ from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
import json
from frappe.utils import getdate, add_days, get_time
from frappe.utils import getdate, get_time
from frappe.model.mapper import get_mapped_doc
from frappe import _
import datetime
@ -174,7 +174,7 @@ def cancel_appointment(appointment_id):
if sales_invoice and cancel_sales_invoice(sales_invoice):
msg = _('Appointment {0} and Sales Invoice {1} cancelled').format(appointment.name, sales_invoice.name)
else:
msg = _('Appointment Cancelled. Please review and cancel the invoice {0}').format(fee_validity.ref_invoice)
msg = _('Appointment Cancelled. Please review and cancel the invoice {0}').format(sales_invoice.name)
else:
fee_validity = manage_fee_validity(appointment)
msg = _('Appointment Cancelled.')

View File

@ -5,7 +5,7 @@ from __future__ import unicode_literals
import unittest
import frappe
from erpnext.healthcare.doctype.patient_appointment.patient_appointment import update_status
from frappe.utils import nowdate, add_days, getdate
from frappe.utils import nowdate, add_days
from frappe.utils.make_random import get_random
class TestPatientAppointment(unittest.TestCase):
@ -72,13 +72,13 @@ def create_healthcare_docs():
medical_department = frappe.new_doc('Medical Department')
medical_department.department = '_Test Medical Department'
medical_department.save(ignore_permissions=True)
department = medical_department.name
medical_department = medical_department.name
if not practitioner:
practitioner = frappe.new_doc('Healthcare Practitioner')
practitioner.first_name = '_Test Healthcare Practitioner'
practitioner.gender = 'Female'
practitioner.department = department
practitioner.department = medical_department
practitioner.op_consulting_charge = 500
practitioner.save(ignore_permissions=True)
practitioner = practitioner.name

View File

@ -14,14 +14,14 @@ class PatientEncounter(Document):
update_encounter_medical_record(self)
def after_insert(self):
insert_encounter_medical_record(self)
insert_encounter_to_medical_record(self)
def on_cancel(self):
if self.appointment:
frappe.db.set_value('Patient Appointment', self.appointment, 'status', 'Open')
delete_medical_record(self)
def insert_encounter_medical_record(doc):
def insert_encounter_to_medical_record(doc):
subject = set_subject_field(doc)
medical_record = frappe.new_doc('Patient Medical Record')
medical_record.patient = doc.patient

View File

@ -2,10 +2,6 @@
// For license information, please see license.txt
frappe.ui.form.on('Vital Signs', {
refresh: function(frm) {
},
height: function(frm) {
if (frm.doc.height && frm.doc.weight) {
calculate_bmi(frm);

View File

@ -13,6 +13,7 @@ def execute(filters=None):
class Analytics(object):
def __init__(self, filters=None):
"""Patient Appointment Analytics Report"""
self.filters = frappe._dict(filters or {})
self.months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
self.get_period_date_ranges()

View File

@ -4,10 +4,9 @@
from __future__ import unicode_literals
import frappe
import datetime
from frappe import _
import math
from frappe.utils import time_diff_in_hours, rounded, getdate, add_days
from frappe.utils import time_diff_in_hours, rounded
from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_income_account
from erpnext.healthcare.doctype.fee_validity.fee_validity import create_fee_validity
from erpnext.healthcare.doctype.lab_test.lab_test import create_multiple
@ -171,7 +170,7 @@ def get_clinical_procedures_to_invoice(patient):
for prescription in procedure_prescriptions:
if frappe.db.get_value('Clinical Procedure Template', prescription.procedure, 'is_billable'):
items_to_invoice.append({
clinical_procedures_to_invoice.append({
'reference_type': 'Procedure Prescription',
'reference_name': prescription.name,
'service': frappe.db.get_value('Clinical Procedure Template', prescription.procedure, 'item')

View File

@ -1,3 +1,3 @@
frappe.ready(function() {
// bind events here
})
});

View File

@ -19,7 +19,7 @@
"is_standard": 1,
"login_required": 0,
"max_attachment_size": 0,
"modified": "2020-03-03 01:07:46.147376",
"modified": "2020-03-26 17:25:15.361918",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "patient-registration",
@ -306,12 +306,12 @@
"allow_read_on_all_link_options": 0,
"default": "0",
"fieldname": "tobacco_past_use",
"fieldtype": "Select",
"fieldtype": "Check",
"hidden": 0,
"label": "Do you have a history of Tobacco Consumption?",
"label": "Check if you have a history of Tobacco Consumption",
"max_length": 0,
"max_value": 0,
"options": "Yes\nNo",
"options": "",
"read_only": 0,
"reqd": 0,
"show_in_filter": 0
@ -320,12 +320,12 @@
"allow_read_on_all_link_options": 0,
"default": "0",
"fieldname": "tobacco_current_use",
"fieldtype": "Select",
"fieldtype": "Check",
"hidden": 0,
"label": "Do you consume Tobacco in the present? ",
"label": "Check if you consume Tobacco",
"max_length": 0,
"max_value": 0,
"options": "Yes\nNo",
"options": "",
"read_only": 0,
"reqd": 0,
"show_in_filter": 0
@ -334,12 +334,12 @@
"allow_read_on_all_link_options": 0,
"default": "0",
"fieldname": "alcohol_past_use",
"fieldtype": "Select",
"fieldtype": "Check",
"hidden": 0,
"label": "Do you have a history of Alcohol Consumption?",
"label": "Check if you have a history of Alcohol Consumption",
"max_length": 0,
"max_value": 0,
"options": "Yes\nNo",
"options": "",
"read_only": 0,
"reqd": 0,
"show_in_filter": 0
@ -348,12 +348,12 @@
"allow_read_on_all_link_options": 0,
"default": "0",
"fieldname": "alcohol_current_use",
"fieldtype": "Select",
"fieldtype": "Check",
"hidden": 0,
"label": "Do you consume Alcohol in the present? ",
"label": "Check if you consume Alcohol",
"max_length": 0,
"max_value": 0,
"options": "Yes\nNo",
"options": "",
"read_only": 0,
"reqd": 0,
"show_in_filter": 0