[patch] Revert Manufacturing User role (#11514)

This commit is contained in:
Faris Ansari 2017-11-10 19:15:17 +05:30 committed by Nabin Hait
parent 17b7209032
commit 4ec4e3fb29
2 changed files with 21 additions and 3 deletions

View File

@ -18,8 +18,5 @@ data = {
'set_value': [
['Stock Settings', None, 'show_barcode_field', 1]
],
'restricted_roles': [
'Manufacturing User'
],
'default_portal_role': 'Customer'
}

View File

@ -0,0 +1,21 @@
import frappe
def execute():
if 'Manufacturing' in frappe.get_active_domains(): return
role = 'Manufacturing User'
frappe.db.set_value('Role', role, 'restrict_to_domain', '')
frappe.db.set_value('Role', role, 'disabled', 0)
users = frappe.get_all('Has Role', filters = {
'parenttype': 'User',
'role': ('in', ['System Manager', 'Manufacturing Manager'])
}, fields=['parent'], as_list=1)
for user in users:
_user = frappe.get_doc('User', user[0])
_user.append('roles', {
'role': role
})
_user.flags.ignore_validate = True
_user.save()