the-bantoo/expense_request

Only pickup up Group Accounts

Opened this issue · 0 comments

For normal Expenses Account everything is working perfectly until you have a Group Expenses Accounts than branch off from there to your Expenses Accounts Leaf. eg:

60-6161-7000-Salary

    • 60-6161-70001-Contract Salary
    • 60-6161-70001- Salary

On the current filters it will only pick up the group account : 60-6161-7000-Salary
Here is the current filters:

frm.set_query("expense_account", 'expenses', () => {
			return {
				filters: [
					["Account", "parent_account", "Like", "%Expenses%"]
				]
			}
		});

Here is my code to allow to pick up Leaf Accounts:

frm.set_query("expense_account", 'expenses', () => {
			return {
				filters: [
					["Account", "root_type", "=", "Expense"],
                    ["Account", "is_group", "=", "0"]
				]
			}
		});