mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-01 15:47:06 +00:00
updates to Setup Wizard, set language as first input
This commit is contained in:
@@ -5,12 +5,12 @@ $.extend(cur_frm.cscript, {
|
||||
onload: function(doc) {
|
||||
var me = this;
|
||||
this.timezone = doc.time_zone;
|
||||
|
||||
|
||||
frappe.call({
|
||||
method: "frappe.country_info.get_country_timezone_info",
|
||||
callback: function(data) {
|
||||
erpnext.country_info = data.message.country_info;
|
||||
erpnext.all_timezones = data.message.all_timezones;
|
||||
frappe.country_info = data.message.country_info;
|
||||
frappe.all_timezones = data.message.all_timezones;
|
||||
me.set_timezone_options();
|
||||
cur_frm.set_value("time_zone", me.timezone);
|
||||
}
|
||||
@@ -28,7 +28,7 @@ $.extend(cur_frm.cscript, {
|
||||
var timezones = [];
|
||||
|
||||
if (this.frm.doc.country) {
|
||||
var timezones = (erpnext.country_info[this.frm.doc.country].timezones || []).sort();
|
||||
var timezones = (frappe.country_info[this.frm.doc.country].timezones || []).sort();
|
||||
}
|
||||
|
||||
this.frm.set_value("time_zone", timezones[0]);
|
||||
@@ -38,10 +38,10 @@ $.extend(cur_frm.cscript, {
|
||||
set_timezone_options: function(filtered_options) {
|
||||
var me = this;
|
||||
if(!filtered_options) filtered_options = [];
|
||||
var remaining_timezones = $.map(erpnext.all_timezones, function(v)
|
||||
var remaining_timezones = $.map(frappe.all_timezones, function(v)
|
||||
{ return filtered_options.indexOf(v)===-1 ? v : null; });
|
||||
|
||||
this.frm.set_df_property("time_zone", "options",
|
||||
this.frm.set_df_property("time_zone", "options",
|
||||
(filtered_options.concat([""]).concat(remaining_timezones)).join("\n"));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,174 +1,395 @@
|
||||
{
|
||||
"_last_update": null,
|
||||
"_user_tags": null,
|
||||
"allow_attach": null,
|
||||
"allow_copy": 1,
|
||||
"creation": "2013-05-02 17:53:24.000000",
|
||||
"allow_email": null,
|
||||
"allow_import": null,
|
||||
"allow_print": null,
|
||||
"allow_rename": null,
|
||||
"allow_trash": null,
|
||||
"autoname": null,
|
||||
"change_log": null,
|
||||
"client_script": null,
|
||||
"client_script_core": null,
|
||||
"client_string": null,
|
||||
"colour": null,
|
||||
"creation": "2013-05-02 17:53:24",
|
||||
"custom": null,
|
||||
"default_print_format": null,
|
||||
"description": null,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": null,
|
||||
"dt_template": null,
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "date_and_number_settings",
|
||||
"allow_on_submit": null,
|
||||
"default": null,
|
||||
"depends_on": null,
|
||||
"description": null,
|
||||
"fieldname": "currency_settings",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Date and Number Settings",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"default": "dd-mm-yyyy",
|
||||
"fieldname": "date_format",
|
||||
"fieldtype": "Select",
|
||||
"label": "Date Format",
|
||||
"options": "yyyy-mm-dd\ndd-mm-yyyy\ndd/mm/yyyy\nmm/dd/yyyy\nmm-dd-yyyy",
|
||||
"hidden": null,
|
||||
"ignore_restrictions": null,
|
||||
"in_filter": null,
|
||||
"in_list_view": 1,
|
||||
"label": "Currency Settings",
|
||||
"no_column": null,
|
||||
"no_copy": null,
|
||||
"oldfieldname": null,
|
||||
"oldfieldtype": null,
|
||||
"options": null,
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"description": "This is the default number format. For currencies, please set the number format in the currency master.",
|
||||
"fieldname": "number_format",
|
||||
"fieldtype": "Select",
|
||||
"label": "Number Format",
|
||||
"options": "\n#,###.##\n#.###,##\n# ###.##\n#,###.###\n#,##,###.##\n#.###\n#,###",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"default": "3",
|
||||
"description": "Precision for Float fields (quantities, discounts, percentages etc). Floats will be rounded up to specified decimals. Default = 3",
|
||||
"fieldname": "float_precision",
|
||||
"fieldtype": "Select",
|
||||
"label": "Float Precision",
|
||||
"options": "\n2\n3\n4\n5\n6",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
"print_hide": null,
|
||||
"print_width": null,
|
||||
"read_only": null,
|
||||
"report_hide": null,
|
||||
"reqd": null,
|
||||
"search_index": null,
|
||||
"set_only_once": null,
|
||||
"trigger": null,
|
||||
"width": null
|
||||
},
|
||||
{
|
||||
"allow_on_submit": null,
|
||||
"default": null,
|
||||
"depends_on": null,
|
||||
"description": "If disable, 'Rounded Total' field will not be visible in any transaction",
|
||||
"fieldname": "disable_rounded_total",
|
||||
"fieldtype": "Check",
|
||||
"hidden": null,
|
||||
"ignore_restrictions": null,
|
||||
"in_filter": null,
|
||||
"in_list_view": 1,
|
||||
"label": "Disable Rounded Total",
|
||||
"no_column": null,
|
||||
"no_copy": null,
|
||||
"oldfieldname": null,
|
||||
"oldfieldtype": null,
|
||||
"options": null,
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "currency_settings",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Currency Settings",
|
||||
"permlevel": 0
|
||||
"print_hide": null,
|
||||
"print_width": null,
|
||||
"read_only": 0,
|
||||
"report_hide": null,
|
||||
"reqd": null,
|
||||
"search_index": null,
|
||||
"set_only_once": null,
|
||||
"trigger": null,
|
||||
"width": null
|
||||
},
|
||||
{
|
||||
"allow_on_submit": null,
|
||||
"default": "INR",
|
||||
"depends_on": null,
|
||||
"description": null,
|
||||
"fieldname": "default_currency",
|
||||
"fieldtype": "Link",
|
||||
"hidden": null,
|
||||
"ignore_restrictions": null,
|
||||
"in_filter": null,
|
||||
"in_list_view": 1,
|
||||
"label": "Default Currency",
|
||||
"no_column": null,
|
||||
"no_copy": null,
|
||||
"oldfieldname": null,
|
||||
"oldfieldtype": null,
|
||||
"options": "Currency",
|
||||
"permlevel": 0,
|
||||
"print_hide": null,
|
||||
"print_width": null,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
"report_hide": null,
|
||||
"reqd": 1,
|
||||
"search_index": null,
|
||||
"set_only_once": null,
|
||||
"trigger": null,
|
||||
"width": null
|
||||
},
|
||||
{
|
||||
"allow_on_submit": null,
|
||||
"default": null,
|
||||
"depends_on": null,
|
||||
"description": "Do not show any symbol like $ etc next to currencies.",
|
||||
"fieldname": "hide_currency_symbol",
|
||||
"fieldtype": "Select",
|
||||
"hidden": null,
|
||||
"ignore_restrictions": null,
|
||||
"in_filter": null,
|
||||
"in_list_view": 1,
|
||||
"label": "Hide Currency Symbol",
|
||||
"no_column": null,
|
||||
"no_copy": null,
|
||||
"oldfieldname": null,
|
||||
"oldfieldtype": null,
|
||||
"options": "\nNo\nYes",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
"print_hide": null,
|
||||
"print_width": null,
|
||||
"read_only": 0,
|
||||
"report_hide": null,
|
||||
"reqd": null,
|
||||
"search_index": null,
|
||||
"set_only_once": null,
|
||||
"trigger": null,
|
||||
"width": null
|
||||
},
|
||||
{
|
||||
"allow_on_submit": null,
|
||||
"default": null,
|
||||
"depends_on": null,
|
||||
"description": null,
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": null,
|
||||
"ignore_restrictions": null,
|
||||
"in_filter": null,
|
||||
"in_list_view": 1,
|
||||
"label": "Company Settings",
|
||||
"no_column": null,
|
||||
"no_copy": null,
|
||||
"oldfieldname": null,
|
||||
"oldfieldtype": null,
|
||||
"options": null,
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
"print_hide": null,
|
||||
"print_width": null,
|
||||
"read_only": 0,
|
||||
"report_hide": null,
|
||||
"reqd": null,
|
||||
"search_index": null,
|
||||
"set_only_once": null,
|
||||
"trigger": null,
|
||||
"width": null
|
||||
},
|
||||
{
|
||||
"allow_on_submit": null,
|
||||
"default": null,
|
||||
"depends_on": null,
|
||||
"description": null,
|
||||
"fieldname": "default_company",
|
||||
"fieldtype": "Link",
|
||||
"hidden": null,
|
||||
"ignore_restrictions": null,
|
||||
"in_filter": null,
|
||||
"in_list_view": null,
|
||||
"label": "Default Company",
|
||||
"no_column": null,
|
||||
"no_copy": null,
|
||||
"oldfieldname": null,
|
||||
"oldfieldtype": null,
|
||||
"options": "Company",
|
||||
"permlevel": 0,
|
||||
"print_hide": null,
|
||||
"print_width": null,
|
||||
"read_only": 0,
|
||||
"reqd": 0
|
||||
"report_hide": null,
|
||||
"reqd": 0,
|
||||
"search_index": null,
|
||||
"set_only_once": null,
|
||||
"trigger": null,
|
||||
"width": null
|
||||
},
|
||||
{
|
||||
"allow_on_submit": null,
|
||||
"default": null,
|
||||
"depends_on": null,
|
||||
"description": null,
|
||||
"fieldname": "current_fiscal_year",
|
||||
"fieldtype": "Link",
|
||||
"hidden": null,
|
||||
"ignore_restrictions": null,
|
||||
"in_filter": null,
|
||||
"in_list_view": null,
|
||||
"label": "Current Fiscal Year",
|
||||
"no_column": null,
|
||||
"no_copy": null,
|
||||
"oldfieldname": null,
|
||||
"oldfieldtype": null,
|
||||
"options": "Fiscal Year",
|
||||
"permlevel": 0,
|
||||
"print_hide": null,
|
||||
"print_width": null,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
"report_hide": null,
|
||||
"reqd": 1,
|
||||
"search_index": null,
|
||||
"set_only_once": null,
|
||||
"trigger": null,
|
||||
"width": null
|
||||
},
|
||||
{
|
||||
"allow_on_submit": null,
|
||||
"default": null,
|
||||
"depends_on": null,
|
||||
"description": null,
|
||||
"fieldname": "system",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": null,
|
||||
"ignore_restrictions": null,
|
||||
"in_filter": null,
|
||||
"in_list_view": null,
|
||||
"label": "System Settings",
|
||||
"no_column": null,
|
||||
"no_copy": null,
|
||||
"oldfieldname": null,
|
||||
"oldfieldtype": null,
|
||||
"options": null,
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"description": "Session Expiry in Hours e.g. 06:00",
|
||||
"fieldname": "session_expiry",
|
||||
"fieldtype": "Data",
|
||||
"label": "Session Expiry",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
"print_hide": null,
|
||||
"print_width": null,
|
||||
"read_only": 0,
|
||||
"report_hide": null,
|
||||
"reqd": null,
|
||||
"search_index": null,
|
||||
"set_only_once": null,
|
||||
"trigger": null,
|
||||
"width": null
|
||||
},
|
||||
{
|
||||
"allow_on_submit": null,
|
||||
"default": null,
|
||||
"depends_on": null,
|
||||
"description": null,
|
||||
"fieldname": "country",
|
||||
"fieldtype": "Select",
|
||||
"hidden": null,
|
||||
"ignore_restrictions": null,
|
||||
"in_filter": null,
|
||||
"in_list_view": null,
|
||||
"label": "Country",
|
||||
"no_column": null,
|
||||
"no_copy": null,
|
||||
"oldfieldname": null,
|
||||
"oldfieldtype": null,
|
||||
"options": "link:Country",
|
||||
"permlevel": 0
|
||||
"permlevel": 0,
|
||||
"print_hide": null,
|
||||
"print_width": null,
|
||||
"read_only": null,
|
||||
"report_hide": null,
|
||||
"reqd": null,
|
||||
"search_index": null,
|
||||
"set_only_once": null,
|
||||
"trigger": null,
|
||||
"width": null
|
||||
},
|
||||
{
|
||||
"allow_on_submit": null,
|
||||
"default": null,
|
||||
"depends_on": null,
|
||||
"description": null,
|
||||
"fieldname": "sms_sender_name",
|
||||
"fieldtype": "Data",
|
||||
"hidden": null,
|
||||
"ignore_restrictions": null,
|
||||
"in_filter": null,
|
||||
"in_list_view": null,
|
||||
"label": "SMS Sender Name",
|
||||
"no_column": null,
|
||||
"no_copy": null,
|
||||
"oldfieldname": null,
|
||||
"oldfieldtype": null,
|
||||
"options": null,
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_3",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
"print_hide": null,
|
||||
"print_width": null,
|
||||
"read_only": 0,
|
||||
"report_hide": null,
|
||||
"reqd": null,
|
||||
"search_index": null,
|
||||
"set_only_once": null,
|
||||
"trigger": null,
|
||||
"width": null
|
||||
},
|
||||
{
|
||||
"allow_on_submit": null,
|
||||
"default": null,
|
||||
"depends_on": null,
|
||||
"description": "For Server Side Print Formats",
|
||||
"fieldname": "print_style",
|
||||
"fieldtype": "Select",
|
||||
"hidden": null,
|
||||
"ignore_restrictions": null,
|
||||
"in_filter": null,
|
||||
"in_list_view": null,
|
||||
"label": "Print Format Style",
|
||||
"no_column": null,
|
||||
"no_copy": null,
|
||||
"oldfieldname": null,
|
||||
"oldfieldtype": null,
|
||||
"options": "Standard\nClassic\nModern\nSpartan",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "time_zone",
|
||||
"fieldtype": "Select",
|
||||
"label": "Time Zone",
|
||||
"permlevel": 0
|
||||
"print_hide": null,
|
||||
"print_width": null,
|
||||
"read_only": 0,
|
||||
"report_hide": null,
|
||||
"reqd": null,
|
||||
"search_index": null,
|
||||
"set_only_once": null,
|
||||
"trigger": null,
|
||||
"width": null
|
||||
}
|
||||
],
|
||||
"hide_heading": null,
|
||||
"hide_toolbar": 0,
|
||||
"icon": "icon-cog",
|
||||
"idx": 1,
|
||||
"in_create": 1,
|
||||
"in_dialog": null,
|
||||
"is_submittable": null,
|
||||
"is_transaction_doc": null,
|
||||
"issingle": 1,
|
||||
"modified": "2014-02-19 19:11:58.000000",
|
||||
"istable": null,
|
||||
"max_attachments": null,
|
||||
"menu_index": null,
|
||||
"modified": "2014-04-17 16:58:54.093191",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Global Defaults",
|
||||
"name_case": null,
|
||||
"owner": "Administrator",
|
||||
"parent": null,
|
||||
"parent_node": null,
|
||||
"parentfield": null,
|
||||
"parenttype": null,
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": null,
|
||||
"email": null,
|
||||
"export": null,
|
||||
"import": null,
|
||||
"match": null,
|
||||
"permlevel": 0,
|
||||
"print": null,
|
||||
"read": 1,
|
||||
"report": 0,
|
||||
"restrict": null,
|
||||
"restricted": null,
|
||||
"role": "System Manager",
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"read_only": 1
|
||||
"plugin": null,
|
||||
"print_outline": null,
|
||||
"read_only": 1,
|
||||
"read_only_onload": null,
|
||||
"search_fields": null,
|
||||
"section_style": null,
|
||||
"server_code": null,
|
||||
"server_code_compiled": null,
|
||||
"server_code_core": null,
|
||||
"server_code_error": null,
|
||||
"show_in_menu": null,
|
||||
"smallicon": null,
|
||||
"subject": null,
|
||||
"tag_fields": null,
|
||||
"title_field": null,
|
||||
"use_template": null,
|
||||
"version": null
|
||||
}
|
||||
@@ -4,9 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
"""Global Defaults"""
|
||||
import frappe
|
||||
from frappe import _
|
||||
import frappe.defaults
|
||||
from frappe.utils import cint
|
||||
|
||||
keydict = {
|
||||
# "key in defaults": "key in Global Defaults"
|
||||
@@ -15,11 +13,7 @@ keydict = {
|
||||
'company': 'default_company',
|
||||
'currency': 'default_currency',
|
||||
'hide_currency_symbol':'hide_currency_symbol',
|
||||
'date_format': 'date_format',
|
||||
'number_format': 'number_format',
|
||||
'float_precision': 'float_precision',
|
||||
'account_url':'account_url',
|
||||
'session_expiry': 'session_expiry',
|
||||
'disable_rounded_total': 'disable_rounded_total',
|
||||
}
|
||||
|
||||
@@ -29,9 +23,6 @@ class GlobalDefaults(Document):
|
||||
|
||||
def on_update(self):
|
||||
"""update defaults"""
|
||||
self.validate_session_expiry()
|
||||
self.set_country_and_timezone()
|
||||
|
||||
for key in keydict:
|
||||
frappe.db.set_default(key, self.get(keydict[key], ''))
|
||||
|
||||
@@ -53,15 +44,5 @@ class GlobalDefaults(Document):
|
||||
# clear cache
|
||||
frappe.clear_cache()
|
||||
|
||||
def validate_session_expiry(self):
|
||||
if self.session_expiry:
|
||||
parts = self.session_expiry.split(":")
|
||||
if len(parts)!=2 or not (cint(parts[0]) or cint(parts[1])):
|
||||
frappe.throw(_("Session Expiry must be in format {0}").format("hh:mm"))
|
||||
|
||||
def set_country_and_timezone(self):
|
||||
frappe.db.set_default("country", self.country)
|
||||
frappe.db.set_default("time_zone", self.time_zone)
|
||||
|
||||
def get_defaults(self):
|
||||
return frappe.defaults.get_defaults()
|
||||
|
||||
Reference in New Issue
Block a user