From d6814dde2970e7c8c8f5c6529c343435e78fc77c Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 10 Jul 2012 18:38:59 +0530 Subject: [PATCH] account cleanup started --- erpnext/accounts/doctype/account/account.js | 43 ++--- erpnext/accounts/doctype/account/account.txt | 164 ++++++++++--------- public/css/all-app.css | 13 +- public/css/fields.css | 13 +- 4 files changed, 135 insertions(+), 98 deletions(-) diff --git a/erpnext/accounts/doctype/account/account.js b/erpnext/accounts/doctype/account/account.js index d5300c75b5..b72dc8d830 100644 --- a/erpnext/accounts/doctype/account/account.js +++ b/erpnext/accounts/doctype/account/account.js @@ -14,17 +14,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -// Fetch parent details -// ----------------------------------------- -cur_frm.add_fetch('parent_account', 'debit_or_credit', 'debit_or_credit'); -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']); -} // Onload // ----------------------------------------- @@ -47,22 +36,36 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { cur_frm.cscript.hide_unhide_group_ledger(doc); } +// Fetch parent details +// ----------------------------------------- +cur_frm.add_fetch('parent_account', 'debit_or_credit', 'debit_or_credit'); +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']); +} + // Hide/unhide group or ledger // ----------------------------------------- cur_frm.cscript.hide_unhide_group_ledger = function(doc) { - hide_field(['convert_to_group', 'convert_to_ledger']); - if (cstr(doc.group_or_ledger) == 'Group') unhide_field('convert_to_ledger'); - else if (cstr(doc.group_or_ledger) == 'Ledger') unhide_field('convert_to_group'); + if (cstr(doc.group_or_ledger) == 'Group') { + cur_frm.add_custom_button('Convert to Ledger', + function() { cur_frm.cscript.convert_to_ledger(); }, 'icon-retweet') + } else if (cstr(doc.group_or_ledger) == 'Ledger') { + cur_frm.add_custom_button('Convert to Group', + function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet') + } } - // Convert group to ledger // ----------------------------------------- cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) { - $c_obj(make_doclist(cdt,cdn),'convert_group_to_ledger','',function(r,rt) { + $c_obj(cur_frm.get_doclist(),'convert_group_to_ledger','',function(r,rt) { if(r.message == 1) { - doc.group_or_ledger = 'Ledger'; refresh_field('group_or_ledger'); - cur_frm.cscript.hide_unhide_group_ledger(doc); + cur_frm.cscript.hide_unhide_group_ledger(cur_frm.get_doc()); } }); } @@ -70,11 +73,11 @@ cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) { // Convert ledger to group // ----------------------------------------- cur_frm.cscript.convert_to_group = function(doc, cdt, cdn) { - $c_obj(make_doclist(cdt,cdn),'convert_ledger_to_group','',function(r,rt) { + $c_obj(cur_frm.get_doclist(),'convert_ledger_to_group','',function(r,rt) { if(r.message == 1) { doc.group_or_ledger = 'Group'; refresh_field('group_or_ledger'); - cur_frm.cscript.hide_unhide_group_ledger(doc); + cur_frm.cscript.hide_unhide_group_ledger(cur_frm.get_doc()); } }); } diff --git a/erpnext/accounts/doctype/account/account.txt b/erpnext/accounts/doctype/account/account.txt index ec0ade9db2..1dd023c1a9 100644 --- a/erpnext/accounts/doctype/account/account.txt +++ b/erpnext/accounts/doctype/account/account.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:35:39', + 'creation': '2012-07-03 13:30:50', 'docstatus': 0, - 'modified': '2012-03-27 14:35:39', + 'modified': '2012-07-10 18:34:16', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -26,7 +26,7 @@ 'section_style': u'Tray', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 138 + 'version': 1 }, # These values are common for all DocField @@ -58,14 +58,34 @@ # DocPerm { - 'cancel': 1, - 'create': 1, + 'cancel': 0, + 'create': 0, 'doctype': u'DocPerm', 'permlevel': 0, - 'role': u'Accounts User', + 'role': u'Auditor', 'write': 1 }, + # DocPerm + { + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Auditor', + 'write': 0 + }, + + # DocPerm + { + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 2, + 'role': u'Auditor', + 'write': 0 + }, + # DocPerm { 'cancel': 0, @@ -86,6 +106,26 @@ 'write': 0 }, + # DocPerm + { + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Accounts User', + 'write': 1 + }, + + # DocPerm + { + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Accounts Manager', + 'write': 1 + }, + # DocPerm { 'cancel': 0, @@ -106,16 +146,6 @@ 'write': 0 }, - # DocPerm - { - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Accounts Manager', - 'write': 1 - }, - # DocPerm { 'cancel': 0, @@ -141,7 +171,7 @@ 'doctype': u'DocField', 'fieldname': u'properties', 'fieldtype': u'Section Break', - 'label': u'Properties', + 'label': u'Account Details', 'oldfieldtype': u'Section Break', 'permlevel': 0 }, @@ -170,20 +200,6 @@ 'search_index': 1 }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'parent_account', - 'fieldtype': u'Link', - 'label': u'Parent Account', - 'oldfieldname': u'parent_account', - 'oldfieldtype': u'Link', - 'options': u'Account', - 'permlevel': 0, - 'search_index': 1, - 'trigger': u'Client' - }, - # DocField { 'doctype': u'DocField', @@ -213,26 +229,6 @@ 'search_index': 1 }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'convert_to_group', - 'fieldtype': u'Button', - 'label': u'Convert to Group', - 'permlevel': 0, - 'trigger': u'Client' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'convert_to_ledger', - 'fieldtype': u'Button', - 'label': u'Convert to Ledger', - 'permlevel': 0, - 'trigger': u'Client' - }, - # DocField { 'doctype': u'DocField', @@ -260,6 +256,44 @@ 'search_index': 1 }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'company', + 'fieldtype': u'Link', + 'in_filter': 1, + 'label': u'Company', + 'oldfieldname': u'company', + 'oldfieldtype': u'Link', + 'options': u'Company', + 'permlevel': 1, + 'reqd': 1, + 'search_index': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'column_break1', + 'fieldtype': u'Column Break', + 'permlevel': 0, + 'width': u'50%' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'parent_account', + 'fieldtype': u'Link', + 'label': u'Parent Account', + 'oldfieldname': u'parent_account', + 'oldfieldtype': u'Link', + 'options': u'Account', + 'permlevel': 0, + 'search_index': 1, + 'trigger': u'Client' + }, + # DocField { 'doctype': u'DocField', @@ -292,40 +326,18 @@ # DocField { - 'doctype': u'DocField', - 'fieldname': u'column_break1', - 'fieldtype': u'Column Break', - 'permlevel': 0, - 'width': u'50%' - }, - - # DocField - { + 'colour': u'White:FFF', + 'description': u'If the account is frozen, entries are allowed for the "Account Manager" only.', 'doctype': u'DocField', 'fieldname': u'freeze_account', 'fieldtype': u'Select', - 'label': u'Freeze Account', + 'label': u'Frozen', 'oldfieldname': u'freeze_account', 'oldfieldtype': u'Select', 'options': u'No\nYes', 'permlevel': 2 }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'company', - 'fieldtype': u'Link', - 'in_filter': 1, - 'label': u'Company', - 'oldfieldname': u'company', - 'oldfieldtype': u'Link', - 'options': u'Company', - 'permlevel': 1, - 'reqd': 1, - 'search_index': 1 - }, - # DocField { 'doctype': u'DocField', diff --git a/public/css/all-app.css b/public/css/all-app.css index afeae01e0e..e5e68a16b8 100644 --- a/public/css/all-app.css +++ b/public/css/all-app.css @@ -2492,6 +2492,10 @@ div.sidebar-comment-info { .input_area input, select, textarea { font-size: 14px; padding: 2px; + + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; } .input_area input { @@ -2509,9 +2513,16 @@ div.sidebar-comment-info { width: 80%; padding: 2px 0px; font-size: 12px; + background-color: #eee; + padding: 2px; + border: 1px solid #ddd; + + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; } .disp_area_no_val { - height: 14px; + min-height: 14px; } .no_img { diff --git a/public/css/fields.css b/public/css/fields.css index 3f8aaf3f63..61892eeb72 100644 --- a/public/css/fields.css +++ b/public/css/fields.css @@ -28,6 +28,10 @@ .input_area input, select, textarea { font-size: 14px; padding: 2px; + + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; } .input_area input { @@ -45,9 +49,16 @@ width: 80%; padding: 2px 0px; font-size: 12px; + background-color: #eee; + padding: 2px; + border: 1px solid #ddd; + + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; } .disp_area_no_val { - height: 14px; + min-height: 14px; } .no_img {