Fixes for regional feature of Nepal

This commit is contained in:
Nabin Hait 2018-03-09 13:11:00 +05:30
parent 38cbd71352
commit 096c05ca6f
4 changed files with 15 additions and 22 deletions

View File

@ -750,7 +750,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2018-01-19 15:25:43.166877", "modified": "2018-03-09 15:25:43.166877",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Healthcare", "module": "Healthcare",
"name": "Physician", "name": "Physician",

View File

@ -1,12 +1,13 @@
import frappe import frappe
def execute(): def execute():
if frappe.db.exists("DocType", "Physician"): if frappe.db.exists("DocType", "Physician"):
frappe.reload_doc("healthcare", "doctype", "physician") frappe.reload_doc("healthcare", "doctype", "physician")
frappe.reload_doc("healthcare", "doctype", "physician_service_unit_schedule") frappe.reload_doc("healthcare", "doctype", "physician_service_unit_schedule")
if frappe.db.has_column('Physician', 'physician_schedule'):
for doc in frappe.get_all('Physician'): if frappe.db.has_column('Physician', 'physician_schedule'):
_doc = frappe.get_doc('Physician', doc.name) for doc in frappe.get_all('Physician'):
if _doc.physician_schedule: _doc = frappe.get_doc('Physician', doc.name)
_doc.append('physician_schedules', {'schedule': _doc.physician_schedule}) if _doc.physician_schedule:
_doc.save() _doc.append('physician_schedules', {'schedule': _doc.physician_schedule})
_doc.save()

View File

@ -10,9 +10,4 @@ def check_deletion_permission(doc, method):
if region not in ["Nepal"]: if region not in ["Nepal"]:
return return
else: else:
frappe.throw(_("Deletion is not permitted for country {0}".format(region))) frappe.throw(_("Deletion is not permitted for country {0}".format(region)))
# don't remove this function it is used in tests
def test_method():
'''test function'''
return 'overridden'

View File

@ -9,11 +9,8 @@ class TestInit(unittest.TestCase):
frappe.flags.country = 'India' frappe.flags.country = 'India'
self.assertEqual(test_method(), 'overridden') self.assertEqual(test_method(), 'overridden')
frappe.flags.country = 'Nepal' frappe.flags.country = 'Maldives'
self.assertEqual(test_method(), 'overridden') self.assertEqual(test_method(), 'original')
frappe.flags.country = 'France' frappe.flags.country = 'France'
self.assertEqual(test_method(), 'overridden') self.assertEqual(test_method(), 'overridden')
frappe.flags.country = 'Maldives'
self.assertEqual(test_method(), 'original')