brotherton-erpnext/erpnext/patches/v4_0/move_warehouse_user_to_restrictions.py

14 lines
497 B
Python
Raw Normal View History

# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
2014-02-14 10:17:51 +00:00
import frappe
2014-05-28 13:19:13 +00:00
import frappe.permissions
def execute():
for warehouse, user in frappe.db.sql("""select parent, user from `tabWarehouse User`"""):
2014-05-28 13:19:13 +00:00
frappe.permissions.add_user_permission("Warehouse", warehouse, user)
frappe.delete_doc_if_exists("DocType", "Warehouse User")
frappe.reload_doc("stock", "doctype", "warehouse")