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/hooks.py b/erpnext/hooks.py index 3935f22295d..7ed9b88a408 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -201,7 +201,7 @@ doc_events = { "Sales Invoice": { 'validate': 'erpnext.regional.india.utils.set_place_of_supply', "on_submit": "erpnext.regional.france.utils.create_transaction_log", - "on_trash": "erpnext.regional.france.utils.check_deletion_permission" + "on_trash": ["erpnext.regional.france.utils.check_deletion_permission", "erpnext.regional.nepal.utils.check_deletion_permission"] }, "Payment Entry": { "on_submit": ["erpnext.regional.france.utils.create_transaction_log", "erpnext.accounts.doctype.payment_request.payment_request.make_status_as_paid"], @@ -277,4 +277,4 @@ regional_overrides = { 'Saudi Arabia': { 'erpnext.controllers.taxes_and_totals.update_itemised_tax_data': 'erpnext.regional.united_arab_emirates.utils.update_itemised_tax_data' } -} +} \ No newline at end of file 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/__init__.py b/erpnext/regional/nepal/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/erpnext/regional/nepal/utils.py b/erpnext/regional/nepal/utils.py new file mode 100644 index 00000000000..76801b9d844 --- /dev/null +++ b/erpnext/regional/nepal/utils.py @@ -0,0 +1,13 @@ +# Copyright (c) 2018, Frappe Technologies and contributors +# For license information, please see license.txt + +import frappe +from frappe import _ +from erpnext import get_region + +def check_deletion_permission(doc, method): + region = get_region() + if region not in ["Nepal"]: + return + else: + 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 7524ccca060..7bd6fa8238d 100644 --- a/erpnext/tests/test_regional.py +++ b/erpnext/tests/test_regional.py @@ -9,8 +9,8 @@ class TestInit(unittest.TestCase): frappe.flags.country = 'India' self.assertEqual(test_method(), 'overridden') - frappe.flags.country = 'Nepal' + frappe.flags.country = 'Maldives' self.assertEqual(test_method(), 'original') frappe.flags.country = 'France' - self.assertEqual(test_method(), 'overridden') + self.assertEqual(test_method(), 'overridden') \ No newline at end of file