cleanup global defaults, fix #2838:
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 30ffd1a..849220a 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -128,3 +128,4 @@
erpnext.patches.v5_0.replace_renamed_fields_in_custom_scripts_and_print_formats
erpnext.patches.v5_0.update_from_bom
erpnext.patches.v5_0.update_account_types
+erpnext.patches.v5_0.update_sms_sender
diff --git a/erpnext/patches/v5_0/update_companywise_payment_account.py b/erpnext/patches/v5_0/update_companywise_payment_account.py
index 0c1705f..d9e653a 100644
--- a/erpnext/patches/v5_0/update_companywise_payment_account.py
+++ b/erpnext/patches/v5_0/update_companywise_payment_account.py
@@ -1,7 +1,7 @@
-
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
+from __future__ import unicode_literals
import frappe
def execute():
diff --git a/erpnext/patches/v5_0/update_sms_sender.py b/erpnext/patches/v5_0/update_sms_sender.py
new file mode 100644
index 0000000..9dde44d
--- /dev/null
+++ b/erpnext/patches/v5_0/update_sms_sender.py
@@ -0,0 +1,9 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+ frappe.db.set_value("SMS Settings", "SMS Settings", "sms_sender_name",
+ frappe.db.get_single_value("Global Defaults", "sms_sender_name"))
diff --git a/erpnext/patches/v5_0/update_time_log_title.py b/erpnext/patches/v5_0/update_time_log_title.py
new file mode 100644
index 0000000..c1e9112
--- /dev/null
+++ b/erpnext/patches/v5_0/update_time_log_title.py
@@ -0,0 +1,12 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+ frappe.reload_doctype("Time Log")
+ for d in frappe.get_all("Time Log"):
+ time_log = frappe.get_doc("Time Log", d.name)
+ time_log.set_title()
+ frappe.db.set_value("Time Log", time_log.name, "title", time_log.title)
diff --git a/erpnext/setup/doctype/global_defaults/global_defaults.js b/erpnext/setup/doctype/global_defaults/global_defaults.js
index acc1c8e..da668ca 100644
--- a/erpnext/setup/doctype/global_defaults/global_defaults.js
+++ b/erpnext/setup/doctype/global_defaults/global_defaults.js
@@ -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"));
}
});
diff --git a/erpnext/setup/doctype/global_defaults/global_defaults.json b/erpnext/setup/doctype/global_defaults/global_defaults.json
index 4d8aeb4..1216442 100644
--- a/erpnext/setup/doctype/global_defaults/global_defaults.json
+++ b/erpnext/setup/doctype/global_defaults/global_defaults.json
@@ -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",
diff --git a/erpnext/setup/doctype/global_defaults/global_defaults.py b/erpnext/setup/doctype/global_defaults/global_defaults.py
index 5f5bd6c..8c22880 100644
--- a/erpnext/setup/doctype/global_defaults/global_defaults.py
+++ b/erpnext/setup/doctype/global_defaults/global_defaults.py
@@ -10,7 +10,6 @@
keydict = {
# "key in defaults": "key in Global Defaults"
- "print_style": "print_style",
"fiscal_year": "current_fiscal_year",
'company': 'default_company',
'currency': 'default_currency',
diff --git a/erpnext/setup/doctype/sms_settings/sms_settings.json b/erpnext/setup/doctype/sms_settings/sms_settings.json
index aa054f5..0870f3c 100755
--- a/erpnext/setup/doctype/sms_settings/sms_settings.json
+++ b/erpnext/setup/doctype/sms_settings/sms_settings.json
@@ -40,6 +40,13 @@
"reqd": 1
},
{
+ "fieldname": "sms_sender_name",
+ "fieldtype": "Data",
+ "label": "SMS Sender Name",
+ "permlevel": 0,
+ "precision": ""
+ },
+ {
"fieldname": "static_parameters_section",
"fieldtype": "Column Break",
"permlevel": 0,
@@ -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",
diff --git a/erpnext/setup/doctype/sms_settings/sms_settings.py b/erpnext/setup/doctype/sms_settings/sms_settings.py
index d061a83..058634b 100644
--- a/erpnext/setup/doctype/sms_settings/sms_settings.py
+++ b/erpnext/setup/doctype/sms_settings/sms_settings.py
@@ -29,7 +29,7 @@
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":
diff --git a/erpnext/startup/notifications.py b/erpnext/startup/notifications.py
index 7d6109d..90bd025 100644
--- a/erpnext/startup/notifications.py
+++ b/erpnext/startup/notifications.py
@@ -7,29 +7,29 @@
def get_notification_config():
return { "for_doctype":
{
- "Issue": {"status":"Open"},
- "Warranty Claim": {"status":"Open"},
- "Task": {"status":"Open"},
- "Lead": {"status":"Open"},
- "Contact": {"status":"Open"},
- "Opportunity": {"docstatus":0},
- "Quotation": {"docstatus":0},
- "Sales Order": { "per_delivered": ("<", 100) },
- "Journal Entry": {"docstatus":0},
- "Sales Invoice": { "outstanding_amount": (">", 0) },
- "Purchase Invoice": {"docstatus":0},
- "Leave Application": {"status":"Open"},
- "Expense Claim": {"approval_status":"Draft"},
- "Job Applicant": {"status":"Open"},
- "Purchase Receipt": {"docstatus":0},
- "Delivery Note": {"docstatus":0},
- "Stock Entry": {"docstatus":0},
- "Material Request": {"docstatus":0},
- "Purchase Order": { "per_received": ("<", 100) },
+ "Issue": {"status": "Open"},
+ "Warranty Claim": {"status": "Open"},
+ "Task": {"status": "Open"},
+ "Lead": {"status": "Open"},
+ "Contact": {"status": "Open"},
+ "Opportunity": {"docstatus": 0},
+ "Quotation": {"docstatus": 0},
+ "Sales Order": { "per_delivered": ("<", 100), "status": ("!=", "Stopped"), "docstatus": ("<", 2) },
+ "Journal Entry": {"docstatus": 0},
+ "Sales Invoice": { "outstanding_amount": (">", 0), "docstatus": ("<", 2) },
+ "Purchase Invoice": {"docstatus": 0},
+ "Leave Application": {"status": "Open"},
+ "Expense Claim": {"approval_status": "Draft"},
+ "Job Applicant": {"status": "Open"},
+ "Purchase Receipt": {"docstatus": 0},
+ "Delivery Note": {"docstatus": 0},
+ "Stock Entry": {"docstatus": 0},
+ "Material Request": {"docstatus": 0},
+ "Purchase Order": { "per_received": ("<", 100), "status": ("!=", "Stopped"), "docstatus": ("<", 2) },
"Production Order": { "status": "In Process" },
- "BOM": {"docstatus":0},
- "Timesheet": {"docstatus":0},
- "Time Log": {"status":"Draft"},
- "Time Log Batch": {"status":"Draft"},
+ "BOM": {"docstatus": 0},
+ "Timesheet": {"docstatus": 0},
+ "Time Log": {"status": "Draft"},
+ "Time Log Batch": {"status": "Draft"},
}
}