Merge pull request #12207 from hasnain2808/patch-rename-list-view-setting
fix(List View Settings): Patch rename list view setting
This commit is contained in:
commit
cf8e6c9ae9
2 changed files with 21 additions and 0 deletions
|
|
@ -329,3 +329,4 @@ frappe.core.doctype.page.patches.drop_unused_pages
|
|||
execute:frappe.get_doc('Role', 'Guest').save() # remove desk access
|
||||
frappe.patches.v13_0.rename_desk_page_to_workspace # 02.02.2021
|
||||
frappe.patches.v13_0.delete_package_publish_tool
|
||||
frappe.patches.v13_0.rename_list_view_setting_to_list_view_settings
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# MIT License. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
if frappe.db.table_exists('List View Setting'):
|
||||
existing_list_view_settings = frappe.get_all('List View Settings', as_list=True)
|
||||
for list_view_setting in frappe.get_all('List View Setting', fields = ['disable_count', 'disable_sidebar_stats', 'disable_auto_refresh', 'name']):
|
||||
name = list_view_setting.pop('name')
|
||||
if name not in [x[0] for x in existing_list_view_settings]:
|
||||
list_view_setting['doctype'] = 'List View Settings'
|
||||
list_view_settings = frappe.get_doc(list_view_setting)
|
||||
# setting name here is necessary because autoname is set as prompt
|
||||
list_view_settings.name = name
|
||||
list_view_settings.insert()
|
||||
frappe.delete_doc("DocType", "List View Setting", force=True)
|
||||
frappe.db.commit()
|
||||
Loading…
Add table
Reference in a new issue