Selaa lähdekoodia

Merge pull request #12207 from hasnain2808/patch-rename-list-view-setting

fix(List View Settings): Patch rename list view setting
version-14
mergify[bot] 4 vuotta sitten
committed by GitHub
vanhempi
commit
cf8e6c9ae9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 muutettua tiedostoa jossa 21 lisäystä ja 0 poistoa
  1. +1
    -0
      frappe/patches.txt
  2. +20
    -0
      frappe/patches/v13_0/rename_list_view_setting_to_list_view_settings.py

+ 1
- 0
frappe/patches.txt Näytä tiedosto

@@ -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

+ 20
- 0
frappe/patches/v13_0/rename_list_view_setting_to_list_view_settings.py Näytä tiedosto

@@ -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()

Ladataan…
Peruuta
Tallenna