Merge pull request #538 from nabinhait/v4-hotfix

Merged language patch with another patch global_defaults_to_system_settings
This commit is contained in:
Pratik Vyas 2014-05-15 18:11:46 +05:30
commit 36740609c6
2 changed files with 0 additions and 25 deletions

View file

@ -28,6 +28,5 @@ frappe.patches.v4_0.deprecate_control_panel
frappe.patches.v4_0.file_manager_hooks
execute:frappe.get_doc("User", "Guest").save()
frappe.patches.v4_0.deprecate_link_selects
frappe.patches.v4_0.set_language_in_system_settings
frappe.patches.v4_0.set_user_gravatar
frappe.patches.v4_0.update_custom_field_insert_after

View file

@ -1,24 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from collections import Counter
from frappe.core.doctype.user.user import STANDARD_USERS
def execute():
if frappe.db.get_value("System Settings", "System Settings", "language"):
return
# find most common language
lang = frappe.db.sql_list("""select language from `tabUser`
where ifnull(language, '')!='' and language not like "Loading%%" and name not in ({standard_users})""".format(
standard_users=", ".join(["%s"]*len(STANDARD_USERS))), tuple(STANDARD_USERS))
lang = Counter(lang).most_common(1)
lang = (len(lang) > 0) and lang[0][0] or "english"
# set language in System Settings
system_settings = frappe.get_doc("System Settings")
system_settings.language = lang
system_settings.ignore_mandatory = True
system_settings.save()