mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-01 07:37:04 +00:00
cleanup global defaults, fix #2838:
This commit is contained in:
@@ -2,46 +2,9 @@
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
$.extend(cur_frm.cscript, {
|
||||
onload: function(doc) {
|
||||
var me = this;
|
||||
this.timezone = doc.time_zone;
|
||||
|
||||
frappe.call({
|
||||
method: "frappe.geo.country_info.get_country_timezone_info",
|
||||
callback: function(data) {
|
||||
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);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
validate: function(doc, cdt, cdn) {
|
||||
return $c_obj(doc, 'get_defaults', '', function(r, rt){
|
||||
sys_defaults = r.message;
|
||||
});
|
||||
},
|
||||
|
||||
country: function() {
|
||||
var me = this;
|
||||
var timezones = [];
|
||||
|
||||
if (this.frm.doc.country) {
|
||||
var timezones = (frappe.country_info[this.frm.doc.country].timezones || []).sort();
|
||||
}
|
||||
|
||||
this.frm.set_value("time_zone", timezones[0]);
|
||||
this.set_timezone_options(timezones);
|
||||
},
|
||||
|
||||
set_timezone_options: function(filtered_options) {
|
||||
var me = this;
|
||||
if(!filtered_options) filtered_options = [];
|
||||
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",
|
||||
(filtered_options.concat([""]).concat(remaining_timezones)).join("\n"));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -5,20 +5,36 @@
|
||||
"doctype": "DocType",
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "currency_settings",
|
||||
"fieldtype": "Section Break",
|
||||
"in_list_view": 0,
|
||||
"label": "",
|
||||
"fieldname": "default_company",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
"label": "Default Company",
|
||||
"options": "Company",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "current_fiscal_year",
|
||||
"fieldtype": "Link",
|
||||
"label": "Current Fiscal Year",
|
||||
"options": "Fiscal Year",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "country",
|
||||
"fieldtype": "Link",
|
||||
"label": "Country",
|
||||
"options": "Country",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"description": "If disable, 'Rounded Total' field will not be visible in any transaction",
|
||||
"fieldname": "disable_rounded_total",
|
||||
"fieldtype": "Check",
|
||||
"in_list_view": 1,
|
||||
"label": "Disable Rounded Total",
|
||||
"fieldname": "column_break_8",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
"precision": ""
|
||||
},
|
||||
{
|
||||
"default": "INR",
|
||||
@@ -43,59 +59,11 @@
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Section Break",
|
||||
"in_list_view": 0,
|
||||
"label": "Company Settings",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "default_company",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
"label": "Default Company",
|
||||
"options": "Company",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "current_fiscal_year",
|
||||
"fieldtype": "Link",
|
||||
"label": "Current Fiscal Year",
|
||||
"options": "Fiscal Year",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "system",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "System Settings",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "country",
|
||||
"fieldtype": "Link",
|
||||
"label": "Country",
|
||||
"options": "Country",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "sms_sender_name",
|
||||
"fieldtype": "Data",
|
||||
"label": "SMS Sender Name",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"description": "For Server Side Print Formats",
|
||||
"fieldname": "print_style",
|
||||
"fieldtype": "Select",
|
||||
"label": "Print Format Style",
|
||||
"options": "Standard\nClassic\nModern\nSpartan",
|
||||
"description": "If disable, 'Rounded Total' field will not be visible in any transaction",
|
||||
"fieldname": "disable_rounded_total",
|
||||
"fieldtype": "Check",
|
||||
"in_list_view": 1,
|
||||
"label": "Disable Rounded Total",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
}
|
||||
@@ -105,7 +73,7 @@
|
||||
"idx": 1,
|
||||
"in_create": 1,
|
||||
"issingle": 1,
|
||||
"modified": "2015-02-20 05:16:23.324563",
|
||||
"modified": "2015-03-02 02:23:20.688406",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Global Defaults",
|
||||
|
||||
@@ -10,7 +10,6 @@ from frappe.custom.doctype.property_setter.property_setter import make_property_
|
||||
|
||||
keydict = {
|
||||
# "key in defaults": "key in Global Defaults"
|
||||
"print_style": "print_style",
|
||||
"fiscal_year": "current_fiscal_year",
|
||||
'company': 'default_company',
|
||||
'currency': 'default_currency',
|
||||
|
||||
@@ -39,6 +39,13 @@
|
||||
"permlevel": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "sms_sender_name",
|
||||
"fieldtype": "Data",
|
||||
"label": "SMS Sender Name",
|
||||
"permlevel": 0,
|
||||
"precision": ""
|
||||
},
|
||||
{
|
||||
"fieldname": "static_parameters_section",
|
||||
"fieldtype": "Column Break",
|
||||
@@ -58,7 +65,7 @@
|
||||
"idx": 1,
|
||||
"in_create": 0,
|
||||
"issingle": 1,
|
||||
"modified": "2015-02-05 05:11:46.834990",
|
||||
"modified": "2015-03-02 02:24:19.692599",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "SMS Settings",
|
||||
|
||||
@@ -29,7 +29,7 @@ def validate_receiver_nos(receiver_list):
|
||||
|
||||
def get_sender_name():
|
||||
"returns name as SMS sender"
|
||||
sender_name = frappe.db.get_value('Global Defaults', None, 'sms_sender_name') or \
|
||||
sender_name = frappe.db.get_single_value('SMS Settings', 'sms_sender_name') or \
|
||||
'ERPNXT'
|
||||
if len(sender_name) > 6 and \
|
||||
frappe.db.get_default("country") == "India":
|
||||
|
||||
Reference in New Issue
Block a user