removed control panel

This commit is contained in:
Rushabh Mehta 2014-04-04 12:00:36 +05:30
parent 312ba99e71
commit 558a9aabfb
11 changed files with 20 additions and 29 deletions

View File

@ -245,8 +245,7 @@ cur_frm.cscript.hide_fields = function(doc) {
(cint(doc.update_stock)==1 ? true : false)); (cint(doc.update_stock)==1 ? true : false));
// India related fields // India related fields
var cp = frappe.control_panel; if (frappe.boot.sysdefaults.country == 'India') unhide_field(['c_form_applicable', 'c_form_no']);
if (cp.country == 'India') unhide_field(['c_form_applicable', 'c_form_no']);
else hide_field(['c_form_applicable', 'c_form_no']); else hide_field(['c_form_applicable', 'c_form_no']);
cur_frm.refresh_fields(); cur_frm.refresh_fields();

View File

@ -13,7 +13,7 @@ erpnext.hr.EmployeeController = frappe.ui.form.Controller.extend({
onload: function() { onload: function() {
this.setup_leave_approver_select(); this.setup_leave_approver_select();
this.frm.toggle_display(["esic_card_no", "gratuity_lic_id", "pan_number", "pf_number"], 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", ""); if(this.frm.doc.__islocal) this.frm.set_value("employee_name", "");
}, },

View File

@ -20,7 +20,7 @@ def update_user_properties():
frappe.reload_doc("core", "doctype", "docfield") frappe.reload_doc("core", "doctype", "docfield")
for d in frappe.db.sql("""select parent, defkey, defvalue from tabDefaultValue 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 df = frappe.db.sql("""select options from tabDocField
where fieldname=%s and fieldtype='Link'""", d.defkey, as_dict=True) where fieldname=%s and fieldtype='Link'""", d.defkey, as_dict=True)
@ -28,7 +28,7 @@ def update_user_properties():
frappe.db.sql("""update tabDefaultValue frappe.db.sql("""update tabDefaultValue
set defkey=%s, parenttype='Restriction' set defkey=%s, parenttype='Restriction'
where defkey=%s and 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(): def update_user_match():
import frappe.defaults import frappe.defaults
@ -97,7 +97,7 @@ def remove_duplicate_restrictions():
# remove duplicate restrictions (if they exist) # remove duplicate restrictions (if they exist)
for d in frappe.db.sql("""select parent, defkey, defvalue, for d in frappe.db.sql("""select parent, defkey, defvalue,
count(*) as cnt from tabDefaultValue 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): group by parent, defkey, defvalue""", as_dict=1):
if d.cnt > 1: if d.cnt > 1:
# order by parenttype so that restriction does not get removed! # order by parenttype so that restriction does not get removed!

View File

@ -332,8 +332,7 @@ class Company(Document):
for d in acc_list_common: for d in acc_list_common:
self.add_acc(d) self.add_acc(d)
country = frappe.db.sql("select value from tabSingles where field = 'country' and doctype = 'Control Panel'") country = frappe.db.get_default("country")
country = country and cstr(country[0][0]) or ''
# load taxes (only for India) # load taxes (only for India)
if country == 'India': if country == 'India':

View File

@ -29,7 +29,7 @@ class GlobalDefaults(Document):
def on_update(self): def on_update(self):
"""update defaults""" """update defaults"""
self.validate_session_expiry() self.validate_session_expiry()
self.update_control_panel() self.set_country_and_timezone()
for key in keydict: for key in keydict:
frappe.db.set_default(key, self.get(keydict[key], '')) frappe.db.set_default(key, self.get(keydict[key], ''))
@ -59,14 +59,9 @@ class GlobalDefaults(Document):
frappe.msgprint("""Session Expiry must be in format hh:mm""", frappe.msgprint("""Session Expiry must be in format hh:mm""",
raise_exception=1) raise_exception=1)
def update_control_panel(self): def set_country_and_timezone(self):
cp_doc = frappe.get_doc("Control Panel") frappe.db.set_default("country", self.country)
if self.country: frappe.db.set_default("time_zone", self.time_zone)
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 get_defaults(self): def get_defaults(self):
return frappe.defaults.get_defaults() return frappe.defaults.get_defaults()

View File

@ -10,7 +10,7 @@ def after_install():
import_country_and_currency() import_country_and_currency()
from erpnext.accounts.doctype.chart_of_accounts.import_charts import import_charts from erpnext.accounts.doctype.chart_of_accounts.import_charts import import_charts
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() feature_setup()
from erpnext.setup.page.setup_wizard.setup_wizard import add_all_roles_to from erpnext.setup.page.setup_wizard.setup_wizard import add_all_roles_to
add_all_roles_to("Administrator") add_all_roles_to("Administrator")
@ -138,7 +138,7 @@ def feature_setup():
def set_single_defaults(): def set_single_defaults():
for dt in frappe.db.sql_list("""select name from `tabDocType` 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` default_values = frappe.db.sql("""select fieldname, `default` from `tabDocField`
where parent=%s""", dt) where parent=%s""", dt)
if default_values: if default_values:

View File

@ -106,7 +106,7 @@ frappe.pages['setup-wizard'].onload = function(wrapper) {
var parts = slide.get_input("company_name").val().split(" "); var parts = slide.get_input("company_name").val().split(" ");
var abbr = $.map(parts, function(p) { return p ? p.substr(0,1) : null }).join(""); var abbr = $.map(parts, function(p) { return p ? p.substr(0,1) : null }).join("");
slide.get_input("company_abbr").val(abbr.toUpperCase()); 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() { slide.get_input("fy_start_date").on("change", function() {
var year_end_date = var year_end_date =

View File

@ -31,7 +31,7 @@ def setup_account(args=None):
create_items(args) create_items(args)
create_customers(args) create_customers(args)
create_suppliers(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.clear_cache()
frappe.db.commit() frappe.db.commit()
@ -166,10 +166,8 @@ def set_defaults(args):
email_settings.send_print_in_body_and_attachment = 1 email_settings.send_print_in_body_and_attachment = 1
email_settings.save() email_settings.save()
# control panel # default
cp = frappe.get_doc("Control Panel", "Control Panel") frappe.db.set_default("company_name", args["company_name"])
cp.company_name = args["company_name"]
cp.save()
def create_feed_and_todo(): def create_feed_and_todo():
"""update activty feed and create todo for creation of item, customer, vendor""" """update activty feed and create todo for creation of item, customer, vendor"""
@ -345,7 +343,7 @@ def add_all_roles_to(name):
def create_territories(): def create_territories():
"""create two default territories, one for home country and one named Rest of the World""" """create two default territories, one for home country and one named Rest of the World"""
from frappe.utils.nestedset import get_root_of 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") root_territory = get_root_of("Territory")
for name in (country, "Rest Of The World"): for name in (country, "Rest Of The World"):
if name and not frappe.db.exists("Territory", name): if name and not frappe.db.exists("Territory", name):

View File

@ -41,7 +41,7 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
}); });
} }
if(frappe.boot.control_panel.country == 'India') { if(frappe.boot.sysdefaults.country == 'India') {
unhide_field(['challan_no', 'challan_date']); unhide_field(['challan_no', 'challan_date']);
} }
}, },

View File

@ -192,7 +192,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
}, },
add_excise_button: function() { 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() { this.frm.add_custom_button(frappe._("Make Excise Invoice"), function() {
var excise = frappe.model.make_new_doc_and_get_name('Journal Voucher'); var excise = frappe.model.make_new_doc_and_get_name('Journal Voucher');
excise = locals['Journal Voucher'][excise]; excise = locals['Journal Voucher'][excise];

View File

@ -33,7 +33,7 @@ class SMSControl(Document):
sender_name = frappe.db.get_value('Global Defaults', None, 'sms_sender_name') or \ sender_name = frappe.db.get_value('Global Defaults', None, 'sms_sender_name') or \
'ERPNXT' 'ERPNXT'
if len(sender_name) > 6 and \ if len(sender_name) > 6 and \
frappe.db.get_value("Control Panel", None, "country") == "India": frappe.db.get_default("country") == "India":
throw(_(""" throw(_("""
As per TRAI rule, sender name must be exactly 6 characters. As per TRAI rule, sender name must be exactly 6 characters.
Kindly change sender name in Setup --> Global Defaults. Kindly change sender name in Setup --> Global Defaults.