Merge pull request #18295 from rohitwaghchaure/fixed_dr_cr_issue_account_tree

fix: Dr / Cr label for balance of the ledgers in the account tree
This commit is contained in:
rohitwaghchaure 2019-07-14 17:00:58 +05:30 committed by GitHub
commit f414c8945f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -121,7 +121,7 @@ frappe.treeview_settings["Account"] = {
},
onrender: function(node) {
if(frappe.boot.user.can_read.indexOf("GL Entry") !== -1){
var dr_or_cr = node.data.balance < 0 ? "Cr" : "Dr";
var dr_or_cr = in_list(["Liability", "Income", "Equity"], node.data.root_type) ? "Cr" : "Dr";
if (node.data && node.data.balance!==undefined) {
$('<span class="balance-area pull-right text-muted small">'
+ (node.data.balance_in_account_currency ?

View File

@ -734,6 +734,7 @@ def get_children(doctype, parent, company, is_root=False):
parent_fieldname = 'parent_' + doctype.lower().replace(' ', '_')
fields = [
'name as value',
'root_type',
'is_group as expandable'
]
filters = [['docstatus', '<', 2]]
@ -741,7 +742,7 @@ def get_children(doctype, parent, company, is_root=False):
filters.append(['ifnull(`{0}`,"")'.format(parent_fieldname), '=', '' if is_root else parent])
if is_root:
fields += ['root_type', 'report_type', 'account_currency'] if doctype == 'Account' else []
fields += ['report_type', 'account_currency'] if doctype == 'Account' else []
filters.append(['company', '=', company])
else: