Merge pull request #37608 from kaulith/fix-link-filters-enforcement
fix: enforce link_filters on link fields server-side
This commit is contained in:
commit
0543af80c3
2 changed files with 12 additions and 1 deletions
|
|
@ -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"))
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue