removed control panel
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 077c913..a876776 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -245,8 +245,7 @@
(cint(doc.update_stock)==1 ? true : false));
// India related fields
- var cp = frappe.control_panel;
- if (cp.country == 'India') unhide_field(['c_form_applicable', 'c_form_no']);
+ if (frappe.boot.sysdefaults.country == 'India') unhide_field(['c_form_applicable', 'c_form_no']);
else hide_field(['c_form_applicable', 'c_form_no']);
cur_frm.refresh_fields();
diff --git a/erpnext/hr/doctype/employee/employee.js b/erpnext/hr/doctype/employee/employee.js
index 88cf7ca..72f5404 100644
--- a/erpnext/hr/doctype/employee/employee.js
+++ b/erpnext/hr/doctype/employee/employee.js
@@ -13,7 +13,7 @@
onload: function() {
this.setup_leave_approver_select();
this.frm.toggle_display(["esic_card_no", "gratuity_lic_id", "pan_number", "pf_number"],
- frappe.control_panel.country==="India");
+ frappe.boot.sysdefaults.country==="India");
if(this.frm.doc.__islocal) this.frm.set_value("employee_name", "");
},
diff --git a/erpnext/patches/4_0/update_user_properties.py b/erpnext/patches/4_0/update_user_properties.py
index 0c3aa4a..2e224ce 100644
--- a/erpnext/patches/4_0/update_user_properties.py
+++ b/erpnext/patches/4_0/update_user_properties.py
@@ -20,7 +20,7 @@
frappe.reload_doc("core", "doctype", "docfield")
for d in frappe.db.sql("""select parent, defkey, defvalue from tabDefaultValue
- where parent not in ('__global', 'Control Panel')""", as_dict=True):
+ where parent not in ('__global', '__default')""", as_dict=True):
df = frappe.db.sql("""select options from tabDocField
where fieldname=%s and fieldtype='Link'""", d.defkey, as_dict=True)
@@ -28,7 +28,7 @@
frappe.db.sql("""update tabDefaultValue
set defkey=%s, parenttype='Restriction'
where defkey=%s and
- parent not in ('__global', 'Control Panel')""", (df[0].options, d.defkey))
+ parent not in ('__global', '__default')""", (df[0].options, d.defkey))
def update_user_match():
import frappe.defaults
@@ -97,7 +97,7 @@
# remove duplicate restrictions (if they exist)
for d in frappe.db.sql("""select parent, defkey, defvalue,
count(*) as cnt from tabDefaultValue
- where parent not in ('__global', 'Control Panel')
+ where parent not in ('__global', '__default')
group by parent, defkey, defvalue""", as_dict=1):
if d.cnt > 1:
# order by parenttype so that restriction does not get removed!
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index 111a180..77bfca4 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -332,8 +332,7 @@
for d in acc_list_common:
self.add_acc(d)
- country = frappe.db.sql("select value from tabSingles where field = 'country' and doctype = 'Control Panel'")
- country = country and cstr(country[0][0]) or ''
+ country = frappe.db.get_default("country")
# load taxes (only for India)
if country == 'India':
diff --git a/erpnext/setup/doctype/global_defaults/global_defaults.py b/erpnext/setup/doctype/global_defaults/global_defaults.py
index dce4f60..93d75a1 100644
--- a/erpnext/setup/doctype/global_defaults/global_defaults.py
+++ b/erpnext/setup/doctype/global_defaults/global_defaults.py
@@ -29,7 +29,7 @@
def on_update(self):
"""update defaults"""
self.validate_session_expiry()
- self.update_control_panel()
+ self.set_country_and_timezone()
for key in keydict:
frappe.db.set_default(key, self.get(keydict[key], ''))
@@ -59,14 +59,9 @@
frappe.msgprint("""Session Expiry must be in format hh:mm""",
raise_exception=1)
- def update_control_panel(self):
- cp_doc = frappe.get_doc("Control Panel")
- if self.country:
- cp_doc.country = self.country
- if self.time_zone:
- cp_doc.time_zone = self.time_zone
- cp_doc.ignore_permissions = True
- cp_doc.save()
+ def set_country_and_timezone(self):
+ frappe.db.set_default("country", self.country)
+ frappe.db.set_default("time_zone", self.time_zone)
def get_defaults(self):
return frappe.defaults.get_defaults()
diff --git a/erpnext/setup/install.py b/erpnext/setup/install.py
index 68bc6cd..94d435e 100644
--- a/erpnext/setup/install.py
+++ b/erpnext/setup/install.py
@@ -10,7 +10,7 @@
import_country_and_currency()
from erpnext.accounts.doctype.chart_of_accounts.import_charts import import_charts
import_charts()
- frappe.db.set_value('Control Panel', None, 'home_page', 'setup-wizard')
+ frappe.db.set_default('desktop:home_page', 'setup-wizard')
feature_setup()
from erpnext.setup.page.setup_wizard.setup_wizard import add_all_roles_to
add_all_roles_to("Administrator")
@@ -138,7 +138,7 @@
def set_single_defaults():
for dt in frappe.db.sql_list("""select name from `tabDocType`
- where issingle=1 and paent != 'Control Panel'"""):
+ where issingle=1 and parent != '__default'"""):
default_values = frappe.db.sql("""select fieldname, `default` from `tabDocField`
where parent=%s""", dt)
if default_values:
diff --git a/erpnext/setup/page/setup_wizard/setup_wizard.js b/erpnext/setup/page/setup_wizard/setup_wizard.js
index a8e6380..8fb8e11 100644
--- a/erpnext/setup/page/setup_wizard/setup_wizard.js
+++ b/erpnext/setup/page/setup_wizard/setup_wizard.js
@@ -106,7 +106,7 @@
var parts = slide.get_input("company_name").val().split(" ");
var abbr = $.map(parts, function(p) { return p ? p.substr(0,1) : null }).join("");
slide.get_input("company_abbr").val(abbr.toUpperCase());
- }).val(frappe.boot.control_panel.company_name || "").trigger("change");
+ }).val(frappe.boot.sysdefaults.company_name || "").trigger("change");
slide.get_input("fy_start_date").on("change", function() {
var year_end_date =
diff --git a/erpnext/setup/page/setup_wizard/setup_wizard.py b/erpnext/setup/page/setup_wizard/setup_wizard.py
index 61a3c71..2a69e10 100644
--- a/erpnext/setup/page/setup_wizard/setup_wizard.py
+++ b/erpnext/setup/page/setup_wizard/setup_wizard.py
@@ -31,7 +31,7 @@
create_items(args)
create_customers(args)
create_suppliers(args)
- frappe.db.set_value('Control Panel', None, 'home_page', 'desktop')
+ frappe.db.set_default('desktop:home_page', 'desktop')
frappe.clear_cache()
frappe.db.commit()
@@ -166,10 +166,8 @@
email_settings.send_print_in_body_and_attachment = 1
email_settings.save()
- # control panel
- cp = frappe.get_doc("Control Panel", "Control Panel")
- cp.company_name = args["company_name"]
- cp.save()
+ # default
+ frappe.db.set_default("company_name", args["company_name"])
def create_feed_and_todo():
"""update activty feed and create todo for creation of item, customer, vendor"""
@@ -345,7 +343,7 @@
def create_territories():
"""create two default territories, one for home country and one named Rest of the World"""
from frappe.utils.nestedset import get_root_of
- country = frappe.db.get_value("Control Panel", None, "country")
+ country = frappe.db.get_default("country")
root_territory = get_root_of("Territory")
for name in (country, "Rest Of The World"):
if name and not frappe.db.exists("Territory", name):
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
index 88dff1a..2359700 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -41,7 +41,7 @@
});
}
- if(frappe.boot.control_panel.country == 'India') {
+ if(frappe.boot.sysdefaults.country == 'India') {
unhide_field(['challan_no', 'challan_date']);
}
},
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index 0ae7e18..07456de 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -192,7 +192,7 @@
},
add_excise_button: function() {
- if(frappe.boot.control_panel.country === "India")
+ if(frappe.boot.sysdefaults.country === "India")
this.frm.add_custom_button(frappe._("Make Excise Invoice"), function() {
var excise = frappe.model.make_new_doc_and_get_name('Journal Voucher');
excise = locals['Journal Voucher'][excise];
diff --git a/erpnext/utilities/doctype/sms_control/sms_control.py b/erpnext/utilities/doctype/sms_control/sms_control.py
index 4408212..ba858c6 100644
--- a/erpnext/utilities/doctype/sms_control/sms_control.py
+++ b/erpnext/utilities/doctype/sms_control/sms_control.py
@@ -33,7 +33,7 @@
sender_name = frappe.db.get_value('Global Defaults', None, 'sms_sender_name') or \
'ERPNXT'
if len(sender_name) > 6 and \
- frappe.db.get_value("Control Panel", None, "country") == "India":
+ frappe.db.get_default("country") == "India":
throw(_("""
As per TRAI rule, sender name must be exactly 6 characters.
Kindly change sender name in Setup --> Global Defaults.