Tree structures don't filter data as per User's Expectations FRAPPE Issue or is it by Design?

Hi

Is this an issue with the frappe framework or is it done by design as to how it searches for the database items in the list view and even reports for tree filters like Territory, Department, Item Group, Customer Group. Currently the team has been converting a lot of tables into the tree which is a good thing but the list view is not updated to show the same results. Let’s take an example for territory in customer list, the territory doctype is a tree structure but when we select a territory in the list view which is a NODE then ideally it should show the results of all the items under that node and not just that node items. See the example below, here in the first screenshot I have searched for territory DELHI which shows a lot of customers but DELHI is a CHILD of NORTH INDIA territory but when we select NORTH INDIA nothing shows up which is not the user must be expecting, also the third screen shot is show the tree view just to confirm this behaviour is not a mistake on user’s part

image

image

image

Just to confirm that this would be a very efficient way to drill down for tree items since it covers the whole of erpnext and not just territory, it should be applicable to reports as well and not just to the list view.

I have created a github issue for the same, surprisingly no one has pointed out this before

3 Likes

@adityaduggal I think almost everybody using ERPNext would encounter this.
Can this be solved using a numeric solution (maybe in the background) similar to adding account numbers - https://github.com/frappe/erpnext/pull/10551

Frappe needs better management of document trees both in the area of filtering and permissions. I raised the permission issue a couple of years back… still open on Github

Kind regards,

Totally agreeing to this.

Need better document trees for filtering and permission. Such issues are only faced in installation with multiple companies/Department/ branches.

Actually it is for single companies too. You have customer groups, item groups, cost centre, etc.

We’ve had some similar problems but with permissions. We wanted to set permissions on a parent territory expecting it would automatically permit the territories on the leaf node but it didn’t. This feature would reduce a lot of permission entries needed for an employee who is supposed to work with say an entire zone like North India or South India in your case but has to be excluded from viewing other territory entries.

1 Like

Well I don’t think that we would need something like account numbers, for the results to be filtered for the child nodes there needs to be a change in the mysql command which filters the data in the list view as below:

if doc.is_group == 1:
    query = """SELECT * FROM `tabDoctype' WHERE lft > %s AND rgt < %s """%(dt.lft, dt.rgt)

And similarly we could have a code run for user permissions when a user permission is created for a group then it automatically creates a user permission for the child nodes and similarly if a group permission is deleted it deletes the permissions for the child nodes and groups. This ways the system becomes more intuitive.

3 Likes

Is it just this? Have you implemented/tested this?
I believe a LOT of end users face this some place or the other in various Doctypes.

Hi everyone,

I am facing the same problems here, it would be great if someone can help me out.

The problem is detailed in this link, I am trying to use a workaround which gets ride of the default value of “All territories”, but not sure how to do that.

I think the post here is also somehow related to my problem.

Thank you in advance for your reply.

2 Likes