From 5c124907097ce2606a6516ed04d53f4ec5d3512e Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 30 Jan 2019 11:48:39 +0530 Subject: [PATCH] fix: patch to add guardian role if not exists --- erpnext/patches.txt | 1 + erpnext/patches/v11_1/__init__.py | 0 erpnext/patches/v11_1/setup_guardian_role.py | 10 ++++++++++ 3 files changed, 11 insertions(+) create mode 100644 erpnext/patches/v11_1/__init__.py create mode 100644 erpnext/patches/v11_1/setup_guardian_role.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index ef632ea8ce..29c86196da 100755 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -584,3 +584,4 @@ erpnext.patches.v11_0.rename_bom_wo_fields erpnext.patches.v11_0.rename_additional_salary_component_additional_salary erpnext.patches.v11_0.renamed_from_to_fields_in_project erpnext.patches.v11_0.add_permissions_in_gst_settings +erpnext.patches.v11_1.setup_guardian_role diff --git a/erpnext/patches/v11_1/__init__.py b/erpnext/patches/v11_1/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/patches/v11_1/setup_guardian_role.py b/erpnext/patches/v11_1/setup_guardian_role.py new file mode 100644 index 0000000000..bb61f9818d --- /dev/null +++ b/erpnext/patches/v11_1/setup_guardian_role.py @@ -0,0 +1,10 @@ +from __future__ import unicode_literals +import frappe + +def execute(): + if 'Education' in frappe.get_active_domains() and not frappe.db.exists("Role", "Guardian"): + frappe.new_doc({ + "doctype": "Role", + "role_name": "Guardian", + "desk_access": 0 + }).insert(ignore_permissions=True)