mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 19:29:10 +00:00
fix in setup control and patch to fix existing docstatus problem
This commit is contained in:
@@ -35,6 +35,10 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
// hide fields if group
|
// hide fields if group
|
||||||
cur_frm.toggle_display(['account_type', 'master_type', 'master_name', 'freeze_account',
|
cur_frm.toggle_display(['account_type', 'master_type', 'master_name', 'freeze_account',
|
||||||
'credit_days', 'credit_limit', 'tax_rate'], doc.group_or_ledger=='Ledger')
|
'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
|
// read-only for root accounts
|
||||||
root_acc = ['Application of Funds (Assets)','Expenses','Income','Source of Funds (Liabilities)'];
|
root_acc = ['Application of Funds (Assets)','Expenses','Income','Source of Funds (Liabilities)'];
|
||||||
@@ -44,8 +48,8 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
} else {
|
} else {
|
||||||
// credit days and type if customer or supplier
|
// credit days and type if customer or supplier
|
||||||
cur_frm.set_intro(null);
|
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))
|
in_list(['Customer', 'Supplier'], doc.master_type));
|
||||||
|
|
||||||
// hide tax_rate
|
// hide tax_rate
|
||||||
cur_frm.cscript.account_type(doc, cdt, cdn);
|
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
|
// Fetch parent details
|
||||||
// -----------------------------------------
|
// -----------------------------------------
|
||||||
cur_frm.add_fetch('parent_account', 'debit_or_credit', 'debit_or_credit');
|
cur_frm.add_fetch('parent_account', 'debit_or_credit', 'debit_or_credit');
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import webnotes
|
||||||
|
def execute():
|
||||||
|
webnotes.conn.sql("""update `tabCompany` set docstatus = 0
|
||||||
|
where docstatus is null""")
|
||||||
|
|
||||||
|
webnotes.conn.sql("""update `tabFiscal Year` set docstatus = 0
|
||||||
|
where docstatus is null""")
|
||||||
6
patches/october_2012/remove_old_trial_bal.py
Normal file
6
patches/october_2012/remove_old_trial_bal.py
Normal file
@@ -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")
|
||||||
14
patches/october_2012/update_account_property.py
Normal file
14
patches/october_2012/update_account_property.py
Normal file
@@ -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)
|
||||||
@@ -627,4 +627,12 @@ patch_list = [
|
|||||||
'patch_module': 'patches.october_2012',
|
'patch_module': 'patches.october_2012',
|
||||||
'patch_file': 'company_fiscal_year_docstatus_patch',
|
'patch_file': 'company_fiscal_year_docstatus_patch',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'patch_module': 'patches.october_2012',
|
||||||
|
'patch_file': 'update_account_property',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'patch_module': 'patches.october_2012',
|
||||||
|
'patch_file': 'remove_old_trial_bal',
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user