From e175dd8249c8fbcb300baebe49c9b711d0128002 Mon Sep 17 00:00:00 2001 From: Himanshu Warekar Date: Thu, 6 Jun 2019 10:58:42 +0530 Subject: [PATCH] patch: set priorities for issue --- erpnext/patches.txt | 1 + erpnext/patches/v12_0/set_priority_for_issue.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 erpnext/patches/v12_0/set_priority_for_issue.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 480facb3ce..d711e1f17b 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -604,3 +604,4 @@ execute:frappe.delete_doc("Report", "Inactive Items") erpnext.patches.v11_1.delete_scheduling_tool erpnext.patches.v12_0.make_custom_fields_for_bank_remittance execute:frappe.delete_doc_if_exists("Page", "support-analytics") +erpnext.patches.v12_0.set_priority_for_issue diff --git a/erpnext/patches/v12_0/set_priority_for_issue.py b/erpnext/patches/v12_0/set_priority_for_issue.py new file mode 100644 index 0000000000..13d0de1311 --- /dev/null +++ b/erpnext/patches/v12_0/set_priority_for_issue.py @@ -0,0 +1,15 @@ +import frappe + +def execute(): + priorities = frappe.get_meta("Issue").get_field("priority").options.split("\n") + + for priority in priorities: + frappe.get_doc({ + "doctype": "Issue Priority", + "name":priority + }).insert(ignore_permissions=True) + + frappe.reload_doc("support", "doctype", "issue") + + for issue in frappe.get_list("Issue", fields=["name", "priority"]): + frappe.db.set_value("Issue", issue.name, "priority", issue.priority) \ No newline at end of file