brotherton-erpnext/erpnext/patches/v8_0/disable_instructor_role.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
538 B
Python
Raw Normal View History

# 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:
2017-10-21 05:50:18 +00:00
if frappe.db.exists("Role", "Instructor"):
role = frappe.get_doc("Role", "Instructor")
role.disabled = 1
role.save(ignore_permissions=True)