Skip to content

fix: convert stored link_filters list to search_link mapping form - #2865

Open
Shindhu-Ramaswamy wants to merge 2 commits into
frappe:developfrom
Shindhu-Ramaswamy:fix-2692-link-filters-dict
Open

Shindhu-Ramaswamy wants to merge 2 commits into
frappe:developfrom
Shindhu-Ramaswamy:fix-2692-link-filters-dict

Conversation

@Shindhu-Ramaswamy

@Shindhu-Ramaswamy Shindhu-Ramaswamy commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Fixes #2692

Fix

parseLinkFilters() now converts the stored list into the dict form before it is
used — same as Desk's parse_filters() in form/controls/link.js. eval: values
are evaluated against { doc, parent } like Desk does.

Updated the call sites in Field.vue, SidePanelLayout.vue and Grid.vue to pass
the doc context. Added unit tests.

To reproduce

  1. Add a custom Link field → User on CRM Lead with
    Link Filters = [["User","user_type","=","System User"]].
  2. Add it to the Lead side panel and click it.
  3. Before: empty dropdown, search_link returns 500.
    After: only System Users are listed.

Frappe stores link_filters as a list of tuples, but search_link (and
User's user_query in particular) expects {fieldname: [operator, value]}.
CRM passed the stored list through as-is, so Link fields with
link_filters returned an empty dropdown and User link fields crashed
the server with 'too many values to unpack'.

Normalise list-form filters in parseLinkFilters(), mirroring Desk's
parse_filters(), so every call site (Field.vue, SidePanelLayout.vue,
Grid.vue) sends the mapping form. Dynamic-link descriptors and 3-tuple
conditions are handled; eval: conditions are skipped since there is no
document context to evaluate them against.
@mergify

mergify Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@greptile-apps

greptile-apps Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge with no new findings.

Reviews (3) · Last reviewed commit: "fix: evaluate eval: link_filters against..."

Comment thread frontend/src/utils/fieldTransforms.js Outdated
@codecov-commenter

codecov-commenter commented Sep 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.86%. Comparing base (e4bd5d9) to head (dd2b59f).
⚠️ Report is 4 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2865      +/-   ##
===========================================
+ Coverage    71.51%   71.86%   +0.35%     
===========================================
  Files          180      181       +1     
  Lines        12757    12859     +102     
===========================================
+ Hits          9123     9241     +118     
+ Misses        3634     3618      -16     
Files with missing lines Coverage Δ
frontend/src/utils/fieldTransforms.js 100.00% <100.00%> (ø)

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread frontend/src/utils/fieldTransforms.js
@Shindhu-Ramaswamy
Shindhu-Ramaswamy marked this pull request as draft September 21, 2026 06:10
@Shindhu-Ramaswamy
Shindhu-Ramaswamy marked this pull request as ready for review September 22, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Link fields with link_filters return empty dropdowns

2 participants