mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-05 22:48:27 +00:00
[fix] [minor] add time zone and country to global defaults
This commit is contained in:
@@ -2,24 +2,27 @@
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
$.extend(cur_frm.cscript, {
|
||||
validate: function(doc, cdt, cdn) {
|
||||
return $c_obj(make_doclist(cdt, cdn), 'get_defaults', '', function(r, rt){
|
||||
sys_defaults = r.message;
|
||||
});
|
||||
},
|
||||
|
||||
refresh: function() {
|
||||
onload: function(doc) {
|
||||
var me = this;
|
||||
this.time_zone = doc.time_zone;
|
||||
|
||||
wn.call({
|
||||
method:"webnotes.country_info.get_country_timezone_info",
|
||||
callback: function(data) {
|
||||
erpnext.country_info = data.message.country_info;
|
||||
erpnext.all_timezones = data.message.all_timezones;
|
||||
// me.set_timezone_options();
|
||||
me.set_timezone_options();
|
||||
cur_frm.set_value("time_zone", me.time_zone);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
validate: function(doc, cdt, cdn) {
|
||||
return $c_obj(make_doclist(cdt, cdn), 'get_defaults', '', function(r, rt){
|
||||
sys_defaults = r.message;
|
||||
});
|
||||
},
|
||||
|
||||
country: function() {
|
||||
var me = this;
|
||||
var timezones = [];
|
||||
@@ -36,9 +39,8 @@ $.extend(cur_frm.cscript, {
|
||||
if(!filtered_options) filtered_options = [];
|
||||
var remaining_timezones = $.map(erpnext.all_timezones, function(v)
|
||||
{ return filtered_options.indexOf(v)===-1 ? v : null; });
|
||||
|
||||
this.frm.fields_dict.time_zone.df.options =
|
||||
(filtered_options.concat([""]).concat(remaining_timezones)).join("\n");
|
||||
refresh_field("time_zone");
|
||||
|
||||
this.frm.set_df_property("time_zone", "options",
|
||||
(filtered_options.concat([""]).concat(remaining_timezones)).join("\n"));
|
||||
}
|
||||
});
|
||||
@@ -61,9 +61,11 @@ class DocType:
|
||||
|
||||
def update_control_panel(self):
|
||||
cp_bean = webnotes.bean("Control Panel")
|
||||
cp_bean.country = self.doc.country
|
||||
cp_bean.time_zone = self.doc.time_zone
|
||||
if self.doc.country:
|
||||
cp_bean.doc.country = self.doc.country
|
||||
if self.doc.time_zone:
|
||||
cp_bean.doc.time_zone = self.doc.time_zone
|
||||
cp_bean.save()
|
||||
|
||||
|
||||
def get_defaults(self):
|
||||
return webnotes.defaults.get_defaults()
|
||||
|
||||
Reference in New Issue
Block a user