Merge pull request #37608 from kaulith/fix-link-filters-enforcement

fix: enforce link_filters on link fields server-side
This commit is contained in:
Ejaaz Khan 2026-03-12 13:54:01 +05:30 committed by GitHub
commit 0543af80c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View file

@ -465,7 +465,7 @@ def validate_link_and_fetch(
)
if not search_result:
return {} # does not exist or filtered out
return {} # Either the record does not exist or was excluded by link_filters
values = None
is_virtual_dt = bool(meta.get("is_virtual"))

View file

@ -938,6 +938,17 @@ frappe.ui.form.ControlLink = class ControlLink extends frappe.ui.form.ControlDat
.then((response) => {
if (!response) return;
const has_filters = !!(args.filters && Object.keys(args.filters).length);
if (!response.name && has_filters) {
frappe.show_alert({
message: __("{0}: {1} did not match any results.", [
__(this.df.label || this.df.fieldname),
value,
]),
indicator: "red",
});
}
update_dependant_fields(response);
return response.name;
});