8000 fix: avoid overriding saved list filters by ankush · Pull Request #31699 · frappe/frappe · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: avoid overriding saved list filters #31699

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions frappe/public/js/frappe/list/list_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
this.show();
const meta = frappe.get_meta(this.doctype);
this.is_large_table = meta?.is_large_table;
this.applied_recency_filters = false;

this.debounced_refresh = frappe.utils.debounce(
this.process_document_refreshes.bind(this),
Expand Down Expand Up @@ -114,18 +113,13 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
}

add_recent_filter_on_large_tables() {
if (
!this.is_large_table ||
this.list_view_settings?.disable_automatic_recency_filters ||
this.applied_recency_filters
) {
if (!this.is_large_table || this.list_view_settings?.disable_automatic_recency_filters) {
return;
}
this.applied_recency_filters = true;
// Note: versions older than v16 should use "modified" here.
const recency_field = "creation";

if (this.filters.filter((arr) => arr?.includes(recency_field)).length) {
if (this.filters.length) {
return;
}
this.filters.push([this.doctype, recency_field, "Timespan", "last 90 days"]);
Expand Down Expand Up @@ -554,11 +548,6 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
before_refresh() {
if (frappe.route_options && this.filter_area) {
this.filters = this.parse_filters_from_route_options();
if (!this.filters.length || window.location.search) {
// Add recency filters if route options are not used
// Route options are internally used in connections to filter for specific documents.
this.add_recent_filter_on_large_tables();
}
frappe.route_options = null;

if (this.filters.length > 0) {
Expand Down
Loading
0