From 91e9e5c47b20f2b1e0c59ba3fbaa6c1615015f40 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 5 Oct 2012 14:18:38 +0530 Subject: [PATCH 1/4] fields disables in account doctype --- accounts/doctype/account/account.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/accounts/doctype/account/account.js b/accounts/doctype/account/account.js index d34601b0ec..a54c83a77a 100644 --- a/accounts/doctype/account/account.js +++ b/accounts/doctype/account/account.js @@ -35,6 +35,10 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { // hide fields if group cur_frm.toggle_display(['account_type', 'master_type', 'master_name', 'freeze_account', 'credit_days', 'credit_limit', 'tax_rate'], doc.group_or_ledger=='Ledger') + + // disable fields + cur_frm.toggle_enable(['account_name', 'debit_or_credit', 'group_or_ledger', + 'is_pl_account', 'company'], false); // read-only for root accounts root_acc = ['Application of Funds (Assets)','Expenses','Income','Source of Funds (Liabilities)']; @@ -45,7 +49,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { // credit days and type if customer or supplier cur_frm.set_intro(null); cur_frm.toggle_display(['credit_days', 'credit_limit'], - in_list(['Customer', 'Supplier'], doc.master_type)) + in_list(['Customer', 'Supplier'], doc.master_type)); // hide tax_rate cur_frm.cscript.account_type(doc, cdt, cdn); @@ -55,6 +59,12 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { } } +cur_frm.cscript.master_type = function(doc, cdt, cdn) { + cur_frm.toggle_display(['credit_days', 'credit_limit', 'master_name'], + in_list(['Customer', 'Supplier'], doc.master_type)); +} + + // Fetch parent details // ----------------------------------------- cur_frm.add_fetch('parent_account', 'debit_or_credit', 'debit_or_credit'); From ee442dc104bc2bf2877b6320985baaf2079a0c95 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 5 Oct 2012 14:32:36 +0530 Subject: [PATCH 2/4] update account property as per root --- patches/october_2012/update_account_property.py | 14 ++++++++++++++ patches/patch_list.py | 4 ++++ 2 files changed, 18 insertions(+) create mode 100644 patches/october_2012/update_account_property.py diff --git a/patches/october_2012/update_account_property.py b/patches/october_2012/update_account_property.py new file mode 100644 index 0000000000..d30f0ccafe --- /dev/null +++ b/patches/october_2012/update_account_property.py @@ -0,0 +1,14 @@ +def execute(): + import webnotes + from webnotes.utils.nestedset import rebuild_tree + rebuild_tree('Account', 'parent_account') + + roots = webnotes.conn.sql(""" + select lft, rgt, debit_or_credit, is_pl_account, company from `tabAccount` + where ifnull(parent_account, '') = '' + """, as_dict=1) + + for acc in roots: + webnotes.conn.sql("""update tabAccount set debit_or_credit = %(debit_or_credit)s, + is_pl_account = %(is_pl_account)s, company = %(company)s + where lft > %(lft)s and rgt < %(rgt)s""", acc, debug=1) \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index f750ac06f5..fc2582a4f4 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -623,4 +623,8 @@ patch_list = [ 'patch_module': 'patches.october_2012', 'patch_file': 'remove_old_customer_contact_address', }, + { + 'patch_module': 'patches.october_2012', + 'patch_file': 'update_account_property', + }, ] From 8579262f611b19396855d64aea2c20ae447b2067 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 5 Oct 2012 14:34:09 +0530 Subject: [PATCH 3/4] hide master_name if not master_type --- accounts/doctype/account/account.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accounts/doctype/account/account.js b/accounts/doctype/account/account.js index a54c83a77a..2d35bd136f 100644 --- a/accounts/doctype/account/account.js +++ b/accounts/doctype/account/account.js @@ -48,7 +48,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { } else { // credit days and type if customer or supplier cur_frm.set_intro(null); - cur_frm.toggle_display(['credit_days', 'credit_limit'], + cur_frm.toggle_display(['credit_days', 'credit_limit', 'master_name'], in_list(['Customer', 'Supplier'], doc.master_type)); // hide tax_rate From 68b8a90ee04f6440b15e254bb6ad99eb90eae66d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 5 Oct 2012 14:47:46 +0530 Subject: [PATCH 4/4] removed old triaL balance report --- patches/october_2012/remove_old_trial_bal.py | 6 ++++++ patches/patch_list.py | 4 ++++ 2 files changed, 10 insertions(+) create mode 100644 patches/october_2012/remove_old_trial_bal.py diff --git a/patches/october_2012/remove_old_trial_bal.py b/patches/october_2012/remove_old_trial_bal.py new file mode 100644 index 0000000000..f3015252b9 --- /dev/null +++ b/patches/october_2012/remove_old_trial_bal.py @@ -0,0 +1,6 @@ +from __future__ import unicode_literals +from webnotes.model import delete_doc + +def execute(): + # remove search criteria + delete_doc("Search Criteria", "trial_balance") diff --git a/patches/patch_list.py b/patches/patch_list.py index fc2582a4f4..98842cc2ab 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -627,4 +627,8 @@ patch_list = [ 'patch_module': 'patches.october_2012', 'patch_file': 'update_account_property', }, + { + 'patch_module': 'patches.october_2012', + 'patch_file': 'remove_old_trial_bal', + }, ]