Setup Wizard: Load number format based on currency #2627, login as first user on setup complete
This commit is contained in:
parent
0fe854692d
commit
a6c361c00e
@ -97,7 +97,7 @@ def get_charts_for_country(country):
|
|||||||
with open(os.path.join(os.path.dirname(__file__), "syscohada_syscohada_chart_template.json"), "r") as f:
|
with open(os.path.join(os.path.dirname(__file__), "syscohada_syscohada_chart_template.json"), "r") as f:
|
||||||
_get_chart_name(f.read())
|
_get_chart_name(f.read())
|
||||||
|
|
||||||
if len(charts) > 1:
|
if len(charts) != 1:
|
||||||
charts.append("Standard")
|
charts.append("Standard")
|
||||||
|
|
||||||
return charts
|
return charts
|
||||||
|
@ -83,11 +83,11 @@ erpnext.wiz.Wizard = Class.extend({
|
|||||||
this.hide_current_slide();
|
this.hide_current_slide();
|
||||||
|
|
||||||
this.current_slide = this.slide_dict[id];
|
this.current_slide = this.slide_dict[id];
|
||||||
this.current_slide.$wrapper.toggle(true);
|
this.current_slide.$wrapper.removeClass("hidden");
|
||||||
},
|
},
|
||||||
hide_current_slide: function() {
|
hide_current_slide: function() {
|
||||||
if(this.current_slide) {
|
if(this.current_slide) {
|
||||||
this.current_slide.$wrapper.toggle(false);
|
this.current_slide.$wrapper.addClass("hidden");
|
||||||
this.current_slide = null;
|
this.current_slide = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -103,7 +103,7 @@ erpnext.wiz.Wizard = Class.extend({
|
|||||||
erpnext.wiz.WizardSlide = Class.extend({
|
erpnext.wiz.WizardSlide = Class.extend({
|
||||||
init: function(opts) {
|
init: function(opts) {
|
||||||
$.extend(this, opts);
|
$.extend(this, opts);
|
||||||
this.$wrapper = $("<div>")
|
this.$wrapper = $('<div class="slide-wrapper hidden"></div>')
|
||||||
.appendTo(this.wiz.parent)
|
.appendTo(this.wiz.parent)
|
||||||
.attr("data-slide-id", this.id);
|
.attr("data-slide-id", this.id);
|
||||||
},
|
},
|
||||||
@ -305,10 +305,11 @@ $.extend(erpnext.wiz, {
|
|||||||
$timezone.empty();
|
$timezone.empty();
|
||||||
|
|
||||||
// add country specific timezones first
|
// add country specific timezones first
|
||||||
if(country){
|
if(country) {
|
||||||
var timezone_list = data.country_info[country].timezones || [];
|
var timezone_list = data.country_info[country].timezones || [];
|
||||||
$timezone.add_options(timezone_list.sort());
|
$timezone.add_options(timezone_list.sort());
|
||||||
slide.get_field("currency").set_input(data.country_info[country].currency);
|
slide.get_field("currency").set_input(data.country_info[country].currency);
|
||||||
|
slide.get_field("currency").$input.trigger("change");
|
||||||
}
|
}
|
||||||
|
|
||||||
// add all timezones at the end, so that user has the option to change it to any timezone
|
// add all timezones at the end, so that user has the option to change it to any timezone
|
||||||
@ -320,6 +321,23 @@ $.extend(erpnext.wiz, {
|
|||||||
frappe.boot.sysdefaults.date_format = (data.country_info[country].date_format
|
frappe.boot.sysdefaults.date_format = (data.country_info[country].date_format
|
||||||
|| "dd-mm-yyyy");
|
|| "dd-mm-yyyy");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
slide.get_input("currency").on("change", function() {
|
||||||
|
var currency = slide.get_input("currency").val();
|
||||||
|
frappe.model.with_doc("Currency", currency, function() {
|
||||||
|
frappe.provide("locals.:Currency." + currency);
|
||||||
|
var currency_doc = frappe.model.get_doc("Currency", currency);
|
||||||
|
var number_format = currency_doc.number_format;
|
||||||
|
if (number_format==="#.###") {
|
||||||
|
number_format = "#.###,##";
|
||||||
|
} else if (number_format==="#,###") {
|
||||||
|
number_format = "#,###.##"
|
||||||
|
}
|
||||||
|
|
||||||
|
frappe.boot.sysdefaults.number_format = number_format;
|
||||||
|
locals[":Currency"][currency] = $.extend({}, currency_doc);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -585,14 +603,7 @@ $.extend(erpnext.wiz, {
|
|||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
wiz.show_complete();
|
wiz.show_complete();
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if(user==="Administrator") {
|
window.location = "/desk";
|
||||||
msgprint(__("Login with your new User ID") + ": " + values.email);
|
|
||||||
setTimeout(function() {
|
|
||||||
frappe.app.logout();
|
|
||||||
}, 2000);
|
|
||||||
} else {
|
|
||||||
window.location = "/desk";
|
|
||||||
}
|
|
||||||
}, 2000);
|
}, 2000);
|
||||||
},
|
},
|
||||||
error: function(r) {
|
error: function(r) {
|
||||||
|
@ -75,6 +75,8 @@ def setup_account(args=None):
|
|||||||
website_maker(args.company_name.strip(), args.company_tagline, args.name)
|
website_maker(args.company_name.strip(), args.company_tagline, args.name)
|
||||||
create_logo(args)
|
create_logo(args)
|
||||||
|
|
||||||
|
login_as_first_user(args)
|
||||||
|
|
||||||
frappe.clear_cache()
|
frappe.clear_cache()
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|
||||||
@ -432,6 +434,11 @@ def create_territories():
|
|||||||
"is_group": "No"
|
"is_group": "No"
|
||||||
}).insert()
|
}).insert()
|
||||||
|
|
||||||
|
def login_as_first_user(args):
|
||||||
|
if args.get("email"):
|
||||||
|
frappe.local.login_manager.user = args.get("email")
|
||||||
|
frappe.local.login_manager.post_login()
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def load_messages(language):
|
def load_messages(language):
|
||||||
frappe.clear_cache()
|
frappe.clear_cache()
|
||||||
@ -444,8 +451,6 @@ def load_messages(language):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def load_languages():
|
def load_languages():
|
||||||
from frappe.sessions import get_geo_from_ip
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"default_language": get_language_from_code(frappe.local.lang),
|
"default_language": get_language_from_code(frappe.local.lang),
|
||||||
"languages": sorted(get_lang_dict().keys())
|
"languages": sorted(get_lang_dict().keys())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user