2016-03-25 11:49:28 +00:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
import frappe
|
|
|
|
|
|
|
|
def execute():
|
2016-08-01 10:00:38 +00:00
|
|
|
frappe.reload_doc("buying", "doctype", "request_for_quotation_supplier")
|
2016-08-01 12:01:17 +00:00
|
|
|
frappe.reload_doc("buying", "doctype", "request_for_quotation_item")
|
2016-08-01 10:00:38 +00:00
|
|
|
frappe.reload_doc("buying", "doctype", "request_for_quotation")
|
|
|
|
frappe.reload_doc("projects", "doctype", "timesheet")
|
|
|
|
|
2016-03-25 11:49:28 +00:00
|
|
|
for role in ('Customer', 'Supplier'):
|
2017-02-20 09:41:56 +00:00
|
|
|
frappe.db.sql('''delete from `tabHas Role`
|
2016-03-25 11:49:28 +00:00
|
|
|
where role=%s and parent in ("Administrator", "Guest")''', role)
|
|
|
|
|
2017-02-20 09:41:56 +00:00
|
|
|
if not frappe.db.sql('select name from `tabHas Role` where role=%s', role):
|
2016-03-25 11:49:28 +00:00
|
|
|
|
|
|
|
# delete DocPerm
|
|
|
|
for doctype in frappe.db.sql('select parent from tabDocPerm where role=%s', role):
|
|
|
|
d = frappe.get_doc("DocType", doctype[0])
|
|
|
|
d.permissions = [p for p in d.permissions if p.role != role]
|
|
|
|
d.save()
|
|
|
|
|
|
|
|
# delete Role
|
|
|
|
frappe.delete_doc_if_exists('Role', role)
|