@frappe.whitelist()
def set_order(new_order, user=None):
 if isinstance(new_order, basestring):
  new_order = json.loads(new_order)
 for (i, module_name) in enumerate(new_order):
  if (module_name not in (u'Explore',)):
   if user:
    icon = get_user_copy(module_name, user)
   else:
    name = frappe.db.get_value(u'Desktop Icon', {u'standard': 1, u'module_name': module_name})
    if name:
     icon = frappe.get_doc(u'Desktop Icon', name)
    else:
     name = add_user_icon(module_name, standard=1)
     icon = frappe.get_doc(u'Desktop Icon', name)
   icon.db_set(u'idx', i)
 clear_desktop_icons_cache()

@ frappe . whitelist ( ) def set_order ( new_order , user = None ) : if isinstance ( new_order , basestring ) : new_order = json . loads ( new_order ) for ( i , module_name ) in enumerate ( new_order ) : if ( module_name not in ( u'Explore' , ) ) : if user : icon = get_user_copy ( module_name , user ) else : name = frappe . db . get_value ( u'Desktop Icon' , { u'standard' : 1 , u'module_name' : module_name } ) if name : icon = frappe . get_doc ( u'Desktop Icon' , name ) else : name = add_user_icon ( module_name , standard = 1 ) icon = frappe . get_doc ( u'Desktop Icon' , name ) icon . db_set ( u'idx' , i ) clear_desktop_icons_cache ( )
set new order by duplicating user icons or set global order .