brotherton-erpnext/erpnext/patches/v8_0/disable_instructor_role.py
2017-10-21 11:20:18 +05:30

18 lines
538 B
Python

# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
"""
disable the instructor role for companies with domain other than
Education.
"""
domains = frappe.db.sql_list("select domain from tabCompany")
if "Education" not in domains:
if frappe.db.exists("Role", "Instructor"):
role = frappe.get_doc("Role", "Instructor")
role.disabled = 1
role.save(ignore_permissions=True)