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,
"istable": 0,
"max_attachments": 0,
"modified": "2018-01-19 15:25:43.166877",
"modified": "2018-03-09 15:25:43.166877",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Physician",

View File

@ -1,12 +1,13 @@
import frappe
def execute():
if frappe.db.exists("DocType", "Physician"):
frappe.reload_doc("healthcare", "doctype", "physician")
frappe.reload_doc("healthcare", "doctype", "physician_service_unit_schedule")
if frappe.db.has_column('Physician', 'physician_schedule'):
for doc in frappe.get_all('Physician'):
_doc = frappe.get_doc('Physician', doc.name)
if _doc.physician_schedule:
_doc.append('physician_schedules', {'schedule': _doc.physician_schedule})
_doc.save()
if frappe.db.exists("DocType", "Physician"):
frappe.reload_doc("healthcare", "doctype", "physician")
frappe.reload_doc("healthcare", "doctype", "physician_service_unit_schedule")
if frappe.db.has_column('Physician', 'physician_schedule'):
for doc in frappe.get_all('Physician'):
_doc = frappe.get_doc('Physician', doc.name)
if _doc.physician_schedule:
_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"]:
return
else:
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'
frappe.throw(_("Deletion is not permitted for country {0}".format(region)))

View File

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