Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
17c790cdbe
@ -40,7 +40,7 @@ $.extend(erpnext.complete_setup, {
|
|||||||
{fieldname:'country', label: 'Country', reqd:1,
|
{fieldname:'country', label: 'Country', reqd:1,
|
||||||
options: "", fieldtype: 'Select'},
|
options: "", fieldtype: 'Select'},
|
||||||
{fieldname:'currency', label: 'Default Currency', reqd:1,
|
{fieldname:'currency', label: 'Default Currency', reqd:1,
|
||||||
options: "Currency", fieldtype: 'Link'},
|
options: "", fieldtype: 'Select'},
|
||||||
{fieldname:'timezone', label: 'Time Zone', reqd:1,
|
{fieldname:'timezone', label: 'Time Zone', reqd:1,
|
||||||
options: "", fieldtype: 'Select'},
|
options: "", fieldtype: 'Select'},
|
||||||
{fieldname:'industry', label: 'Industry', reqd:1,
|
{fieldname:'industry', label: 'Industry', reqd:1,
|
||||||
@ -55,11 +55,17 @@ $.extend(erpnext.complete_setup, {
|
|||||||
}
|
}
|
||||||
|
|
||||||
wn.call({
|
wn.call({
|
||||||
method:"webnotes.country_info.get_all",
|
method:"webnotes.country_info.get_country_timezone_info",
|
||||||
callback: function(data) {
|
callback: function(data) {
|
||||||
erpnext.country_info = data.message;
|
erpnext.country_info = data.message.country_info;
|
||||||
|
erpnext.all_timezones = data.message.all_timezones;
|
||||||
d.get_input("country").empty()
|
d.get_input("country").empty()
|
||||||
.add_options([""].concat(keys(data.message).sort()));
|
.add_options([""].concat(keys(erpnext.country_info).sort()));
|
||||||
|
d.get_input("currency").empty()
|
||||||
|
.add_options(wn.utils.unique([""].concat($.map(erpnext.country_info,
|
||||||
|
function(opts, country) { return opts.currency; }))).sort());
|
||||||
|
d.get_input("timezone").empty()
|
||||||
|
.add_options([""].concat(erpnext.all_timezones));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -82,19 +88,15 @@ $.extend(erpnext.complete_setup, {
|
|||||||
var country = d.fields_dict.country.input.value;
|
var country = d.fields_dict.country.input.value;
|
||||||
var $timezone = $(d.fields_dict.timezone.input);
|
var $timezone = $(d.fields_dict.timezone.input);
|
||||||
$timezone.empty();
|
$timezone.empty();
|
||||||
|
// add country specific timezones first
|
||||||
if(country){
|
if(country){
|
||||||
var timezone_list = erpnext.country_info[country].timezones;
|
var timezone_list = erpnext.country_info[country].timezones || [];
|
||||||
if(timezone_list.length==0) {
|
$timezone.add_options(timezone_list.sort());
|
||||||
timezone_list = $.map(erpnext.country_info, function(m) {
|
|
||||||
return m.timezones
|
|
||||||
});
|
|
||||||
}
|
|
||||||
$timezone.empty().add_options(timezone_list);
|
|
||||||
|
|
||||||
console.log(d.get_input("currency"))
|
|
||||||
|
|
||||||
d.get_input("currency").val(erpnext.country_info[country].currency);
|
d.get_input("currency").val(erpnext.country_info[country].currency);
|
||||||
}
|
}
|
||||||
|
// add all timezones at the end, so that user has the option to change it to any timezone
|
||||||
|
$timezone.add_options([""].concat(erpnext.all_timezones));
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -127,5 +129,5 @@ $.extend(erpnext.complete_setup, {
|
|||||||
'Finance', 'Food and Beverage', 'Government', 'Healthcare', 'Hospitality',
|
'Finance', 'Food and Beverage', 'Government', 'Healthcare', 'Hospitality',
|
||||||
'Information Technology', 'Insurance', 'Machinery', 'Manufacturing', 'Media',
|
'Information Technology', 'Insurance', 'Machinery', 'Manufacturing', 'Media',
|
||||||
'Not For Profit', 'Recreation', 'Retail', 'Shipping', 'Technology',
|
'Not For Profit', 'Recreation', 'Retail', 'Shipping', 'Technology',
|
||||||
'Telecommunications', 'Transportation', 'Trading', 'Utilities', 'Other'],
|
'Telecommunications', 'Transportation', 'Trading', 'Utilities', 'Other'],
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user