fix: Duplicate Toggle width button in Navbar Settings

This commit is contained in:
Deepesh Garg 2020-08-20 11:42:12 +05:30
parent d1196a94da
commit f4bdf61a67
3 changed files with 18 additions and 0 deletions

View file

@ -301,3 +301,4 @@ frappe.patches.v13_0.generate_theme_files_in_public_folder
frappe.patches.v13_0.increase_password_length
frappe.patches.v13_0.add_toggle_width_in_navbar_settings
frappe.patches.v13_0.rename_notification_fields
frappe.patches.v13_0.remove_duplicate_navbar_items

View file

@ -4,6 +4,9 @@ import frappe
def execute():
navbar_settings = frappe.get_single("Navbar Settings")
if frappe.db.exists('Navbar Item', {'item_label': 'Toggle Full Width'}):
return
for navbar_item in navbar_settings.settings_dropdown[5:]:
navbar_item.idx = navbar_item.idx + 1

View file

@ -0,0 +1,14 @@
from __future__ import unicode_literals
import frappe
def execute():
navbar_settings = frappe.get_single("Navbar Settings")
duplicate_items = []
for navbar_item in navbar_settings.settings_dropdown:
if navbar_item.item_label == 'Toggle Full Width':
duplicate_items.append(navbar_item)
if len(duplicate_items) > 1:
navbar_settings.remove(duplicate_item[0])
navbar_settings.save()