From 096c05ca6f20f95a57fba407cda391acd57fe5f0 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 9 Mar 2018 13:11:00 +0530 Subject: [PATCH] Fixes for regional feature of Nepal --- .../doctype/physician/physician.json | 2 +- .../remove_and_copy_fields_in_physician.py | 19 ++++++++++--------- erpnext/regional/nepal/utils.py | 7 +------ erpnext/tests/test_regional.py | 9 +++------ 4 files changed, 15 insertions(+), 22 deletions(-) diff --git a/erpnext/healthcare/doctype/physician/physician.json b/erpnext/healthcare/doctype/physician/physician.json index e29561e91e7..300dc9707d2 100644 --- a/erpnext/healthcare/doctype/physician/physician.json +++ b/erpnext/healthcare/doctype/physician/physician.json @@ -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", diff --git a/erpnext/patches/v10_0/remove_and_copy_fields_in_physician.py b/erpnext/patches/v10_0/remove_and_copy_fields_in_physician.py index bf286449c46..139751a684d 100644 --- a/erpnext/patches/v10_0/remove_and_copy_fields_in_physician.py +++ b/erpnext/patches/v10_0/remove_and_copy_fields_in_physician.py @@ -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() diff --git a/erpnext/regional/nepal/utils.py b/erpnext/regional/nepal/utils.py index 66536ee7623..76801b9d844 100644 --- a/erpnext/regional/nepal/utils.py +++ b/erpnext/regional/nepal/utils.py @@ -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))) \ No newline at end of file diff --git a/erpnext/tests/test_regional.py b/erpnext/tests/test_regional.py index 3f8ebaff49a..7bd6fa8238d 100644 --- a/erpnext/tests/test_regional.py +++ b/erpnext/tests/test_regional.py @@ -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') \ No newline at end of file + self.assertEqual(test_method(), 'overridden') \ No newline at end of file