diff --git a/erpnext/accounts/doctype/account/account.js b/erpnext/accounts/doctype/account/account.js index b72dc8d8300..79c15bf1ae6 100644 --- a/erpnext/accounts/doctype/account/account.js +++ b/erpnext/accounts/doctype/account/account.js @@ -18,22 +18,35 @@ // Onload // ----------------------------------------- cur_frm.cscript.onload = function(doc, cdt, cdn) { - cur_frm.cscript.account_type(doc, cdt, cdn); - // hide India specific fields - var cp = wn.control_panel; - if(cp.country == 'India') - unhide_field(['pan_number', 'tds_applicable', 'tds_details', 'tds']); - else - hide_field(['pan_number', 'tds_applicable', 'tds_details', 'tds']); } // Refresh // ----------------------------------------- cur_frm.cscript.refresh = function(doc, cdt, cdn) { - root_acc = [' Application of Funds (Assets)','Expenses','Income','Source of Funds (Liabilities)']; - if(inList(root_acc, doc.account_name)) - cur_frm.perm = [[1,0,0], [1,0,0]]; - cur_frm.cscript.hide_unhide_group_ledger(doc); + // read-only for root accounts + root_acc = ['Application of Funds (Assets)','Expenses','Income','Source of Funds (Liabilities)']; + if(inList(root_acc, doc.account_name)) + cur_frm.perm = [[1,0,0], [1,0,0]]; + + // hide fields if group + cur_frm.toggle_fields(['account_type', 'master_type', 'master_name', 'freeze_account', + 'credit_days', 'credit_limit'], doc.group_or_ledger=='Ledger') + + // credit days and type if customer or supplier + cur_frm.toggle_fields(['credit_days', 'credit_limit'], + in_list(['Customer', 'Supplier'], doc.master_type)) + + // hide tax_rate + cur_frm.cscript.account_type(doc, cdt, cdn); + + // show / hide convert buttons + cur_frm.cscript.hide_unhide_group_ledger(doc); + + // back to chart of accounts + cur_frm.add_custom_button('Back To Chart of Accounts', function() { + wn.set_route('Accounts Browser', 'Account'); + }, 'icon-arrow-left') + } // Fetch parent details @@ -44,8 +57,8 @@ cur_frm.add_fetch('parent_account', 'is_pl_account', 'is_pl_account'); // Hide tax rate based on account type // ----------------------------------------- cur_frm.cscript.account_type = function(doc, cdt, cdn) { - if(doc.account_type == 'Tax') unhide_field(['tax_rate']); - else hide_field(['tax_rate']); + cur_frm.toggle_fields(['tax_rate'], doc.account_type == 'Tax') + cur_frm.toggle_fields(['master_type', 'master_name'], cstr(doc.account_type)=='') } // Hide/unhide group or ledger @@ -88,11 +101,13 @@ cur_frm.fields_dict['master_name'].get_query=function(doc){ if (doc.master_type){ return 'SELECT `tab'+doc.master_type+'`.name FROM `tab'+doc.master_type+'` WHERE `tab'+doc.master_type+'`.name LIKE "%s" and `tab'+doc.master_type+'`.docstatus != 2 ORDER BY `tab'+doc.master_type+'`.name LIMIT 50'; } - else alert("Please select master type"); } // parent account get query // ----------------------------------------- cur_frm.fields_dict['parent_account'].get_query = function(doc){ - return 'SELECT DISTINCT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.group_or_ledger="Group" AND `tabAccount`.docstatus != 2 AND `tabAccount`.company="'+ doc.company+'" AND `tabAccount`.company is not NULL AND `tabAccount`.name LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50'; + return 'SELECT DISTINCT `tabAccount`.name FROM `tabAccount` WHERE \ + `tabAccount`.group_or_ledger="Group" AND `tabAccount`.docstatus != 2 AND \ + `tabAccount`.company="'+ doc.company+'" AND `tabAccount`.company is not NULL AND \ + `tabAccount`.name LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50'; } diff --git a/erpnext/accounts/doctype/account/account.txt b/erpnext/accounts/doctype/account/account.txt index 1dd023c1a9d..e3ec85a7b27 100644 --- a/erpnext/accounts/doctype/account/account.txt +++ b/erpnext/accounts/doctype/account/account.txt @@ -5,7 +5,7 @@ { 'creation': '2012-07-03 13:30:50', 'docstatus': 0, - 'modified': '2012-07-10 18:34:16', + 'modified': '2012-07-11 09:21:01', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -296,6 +296,8 @@ # DocField { + 'colour': u'White:FFF', + 'description': u'Setting Account Type helps in selecting this Account in transactions.', 'doctype': u'DocField', 'fieldname': u'account_type', 'fieldtype': u'Select', @@ -312,7 +314,7 @@ # DocField { 'colour': u'White:FFF', - 'description': u'If Account Type is "Tax" then the default rate is required.', + 'description': u'Rate at which this tax is applied', 'doctype': u'DocField', 'fieldname': u'tax_rate', 'fieldtype': u'Currency', @@ -340,6 +342,7 @@ # DocField { + 'colour': u'White:FFF', 'doctype': u'DocField', 'fieldname': u'credit_days', 'fieldtype': u'Int', @@ -366,13 +369,15 @@ # DocField { + 'colour': u'White:FFF', + 'description': u'If this Account represents a Customer, Supplier or Employee, set it here.', 'doctype': u'DocField', 'fieldname': u'master_type', 'fieldtype': u'Select', 'label': u'Master Type', 'oldfieldname': u'master_type', 'oldfieldtype': u'Select', - 'options': u'\nNA\nSupplier\nCustomer\nEmployee', + 'options': u'\nSupplier\nCustomer\nEmployee', 'permlevel': 0 }, @@ -386,116 +391,5 @@ 'oldfieldtype': u'Link', 'permlevel': 0, 'trigger': u'Client' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'tds', - 'fieldtype': u'Section Break', - 'label': u'TDS', - 'oldfieldtype': u'Section Break', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'pan_number', - 'fieldtype': u'Data', - 'label': u'PAN Number', - 'oldfieldname': u'pan_number', - 'oldfieldtype': u'Data', - 'permlevel': 0 - }, - - # DocField - { - 'default': u'No', - 'doctype': u'DocField', - 'fieldname': u'tds_applicable', - 'fieldtype': u'Select', - 'label': u'TDS Applicable', - 'oldfieldname': u'tds_applicable', - 'oldfieldtype': u'Select', - 'options': u'\nYes\nNo', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'tds_details', - 'fieldtype': u'Table', - 'label': u'TDS Details', - 'oldfieldname': u'tds_details', - 'oldfieldtype': u'Table', - 'options': u'TDS Detail', - 'permlevel': 0 - }, - - # DocField - { - 'description': u"Don't delete this field at any cost", - 'doctype': u'DocField', - 'fieldname': u'old_parent', - 'fieldtype': u'Link', - 'hidden': 1, - 'label': u'Old Parent', - 'no_copy': 1, - 'oldfieldname': u'old_parent', - 'oldfieldtype': u'Data', - 'options': u'Account', - 'permlevel': 0, - 'report_hide': 1 - }, - - # DocField - { - 'colour': u'White:FFF', - 'description': u"Don't delete this field at any cost", - 'doctype': u'DocField', - 'fieldname': u'lft', - 'fieldtype': u'Int', - 'hidden': 1, - 'in_filter': 1, - 'label': u'Lft', - 'no_copy': 1, - 'oldfieldname': u'lft', - 'oldfieldtype': u'Int', - 'permlevel': 3, - 'print_hide': 1, - 'report_hide': 1, - 'search_index': 1 - }, - - # DocField - { - 'colour': u'White:FFF', - 'description': u"Don't delete this field at any cost", - 'doctype': u'DocField', - 'fieldname': u'rgt', - 'fieldtype': u'Int', - 'hidden': 1, - 'in_filter': 1, - 'label': u'Rgt', - 'no_copy': 1, - 'oldfieldname': u'rgt', - 'oldfieldtype': u'Int', - 'permlevel': 3, - 'print_hide': 1, - 'report_hide': 1, - 'search_index': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'trash_reason', - 'fieldtype': u'Small Text', - 'label': u'Trash Reason', - 'oldfieldname': u'trash_reason', - 'oldfieldtype': u'Small Text', - 'permlevel': 1 } ] \ No newline at end of file diff --git a/public/css/all-app.css b/public/css/all-app.css index e5e68a16b80..6bd1d580373 100644 --- a/public/css/all-app.css +++ b/public/css/all-app.css @@ -2284,23 +2284,13 @@ div.notice { } .help_box, .help-box { - background-color:#FFC; - font-size: 13px; - color: #864; - padding: 7px; + background-color: #ffe; + color: #874; + padding: 9px 9px 9px 9px; + border: 1px dashed #fc7; margin: 11px 0px; - border: 1px solid #EEB; } -.help_box_big { - background-color:#FFC; - color: #864; - padding: 7px; - margin: 7px 0px; - border: 1px solid #EEB; - text-align: center; - font-size: 14px; -} /* * lib/css/legacy/forms.css @@ -2320,10 +2310,8 @@ div.form-title { } div.form-intro-area { - background-color: #ffe; padding: 9px 9px 0px 9px; - border: 1px dashed #fc7; - margin-bottom: 15px; + margin: 0px 0px 15px 0px; } div.form-section-head { diff --git a/public/css/all-web.css b/public/css/all-web.css index a3b6de5ce28..e1311c4baa5 100644 --- a/public/css/all-web.css +++ b/public/css/all-web.css @@ -2145,23 +2145,13 @@ div.notice { } .help_box, .help-box { - background-color:#FFC; - font-size: 13px; - color: #864; - padding: 7px; + background-color: #ffe; + color: #874; + padding: 9px 9px 9px 9px; + border: 1px dashed #fc7; margin: 11px 0px; - border: 1px solid #EEB; } -.help_box_big { - background-color:#FFC; - color: #864; - padding: 7px; - margin: 7px 0px; - border: 1px solid #EEB; - text-align: center; - font-size: 14px; -} /* * lib/css/legacy/dialog.css diff --git a/public/js/all-app.js b/public/js/all-app.js index d7cfcd121f5..d0e47716589 100644 --- a/public/js/all-app.js +++ b/public/js/all-app.js @@ -1220,14 +1220,14 @@ args.colnames=colnames.join(',');args.report_name=report_name?report_name:'';ope * lib/js/legacy/webpage/search.js */ search_fields={};function setlinkvalue(name){selector.input.set_input_value(name);selector.hide();} -function makeselector(){var d=new Dialog(540,440,'Search');d.make_body([['Data','Beginning With','Tip: You can use wildcard "%"'],['Select','Search By'],['Button','Search'],['HTML','Help'],['HTML','Result']]);var inp=d.widgets['Beginning With'];var field_sel=d.widgets['Search By'];var btn=d.widgets['Search'];d.sel_type='';d.values_len=0;d.set=function(input,type,label){d.sel_type=type;d.input=input;if(d.style!='Link'){d.rows['Result'].innerHTML='';d.values_len=0;} +function makeselector(){var d=new Dialog(540,440,'Search');d.make_body([['HTML','Help'],['Data','Beginning With','Tip: You can use wildcard "%"'],['Select','Search By'],['Button','Search'],['HTML','Result']]);var inp=d.widgets['Beginning With'];var field_sel=d.widgets['Search By'];var btn=d.widgets['Search'];d.sel_type='';d.values_len=0;d.set=function(input,type,label){d.sel_type=type;d.input=input;if(d.style!='Link'){d.rows['Result'].innerHTML='';d.values_len=0;} d.style='Link';d.set_query_description() -if(!d.sel_type)d.sel_type='Value';d.set_title('Select a "'+d.sel_type+'" for field "'+label+'"');} +if(!d.sel_type)d.sel_type='Value';d.set_title("Select");d.set_query_description('Select a "'+d.sel_type+'" for field "'+label+'"');} d.set_search=function(dt){if(d.style!='Search'){d.rows['Result'].innerHTML='';d.values_len=0;} d.style='Search';if(d.input){d.input=null;sel_type=null;} d.sel_type=get_label_doctype(dt);d.set_title('Quick Search for '+dt);} $(inp).keydown(function(e){if(e.which==13){if(!btn.disabled)btn.onclick();}}) -d.set_query_description=function(){if(d.input&&d.input.query_description){d.rows['Help'].innerHTML='