diff --git a/erpnext/patches.txt b/erpnext/patches.txt index dae2b4b476..5315f79de6 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -42,3 +42,4 @@ execute:frappe.delete_doc_if_exists("DocType", "Warehouse User") execute:frappe.db.sql("delete from `tabWebsite Item Group` where ifnull(item_group, '')=''") execute:frappe.delete_doc("Print Format", "SalesInvoice") execute:import frappe.defaults;frappe.defaults.clear_default("price_list_currency") +erpnext.patches.v4_0.global_defaults_to_system_settings diff --git a/erpnext/patches/v4_0/global_defaults_to_system_settings.py b/erpnext/patches/v4_0/global_defaults_to_system_settings.py new file mode 100644 index 0000000000..5a3c41c82b --- /dev/null +++ b/erpnext/patches/v4_0/global_defaults_to_system_settings.py @@ -0,0 +1,17 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +# MIT License. See license.txt + +from __future__ import unicode_literals + +import frappe + +def execute(): + global_defauls = frappe.db.get_value("Global Defaults", None, + ["time_zone", "date_format", "number_format", "float_precision", "session_expiry"]) + + if global_defauls: + system_settings = frappe.get_doc("System Settings") + for key, val in global_defauls.items(): + system_settings[key] = val + system_settings.ignore_mandatory = True + system_settings.save()