Merge pull request #23248 from deepeshgarg007/pda_account_filter

fix: Account filter in Process Deferred Accounting doctype
This commit is contained in:
Deepesh Garg
2020-09-03 19:22:56 +05:30
committed by GitHub
2 changed files with 7 additions and 3 deletions

View File

@@ -10,13 +10,15 @@ frappe.ui.form.on('Process Deferred Accounting', {
} }
}; };
}); });
},
if (frm.doc.company) { type: function(frm) {
if (frm.doc.company && frm.doc.type) {
frm.set_query("account", function() { frm.set_query("account", function() {
return { return {
filters: { filters: {
'company': frm.doc.company, 'company': frm.doc.company,
'root_type': 'Liability', 'root_type': frm.doc.type === 'Income' ? 'Liability' : 'Asset',
'is_group': 0 'is_group': 0
} }
}; };

View File

@@ -60,6 +60,7 @@
"reqd": 1 "reqd": 1
}, },
{ {
"depends_on": "eval: doc.type",
"fieldname": "account", "fieldname": "account",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Account", "label": "Account",
@@ -73,9 +74,10 @@
"reqd": 1 "reqd": 1
} }
], ],
"index_web_pages_for_search": 1,
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2020-02-06 18:18:09.852844", "modified": "2020-09-03 18:07:02.463754",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Process Deferred Accounting", "name": "Process Deferred Accounting",