feat(list): config-driven filters + working date range on any doctype - #10
Closed
jcfrei wants to merge 1 commit into
Closed
feat(list): config-driven filters + working date range on any doctype#10jcfrei wants to merge 1 commit into
jcfrei wants to merge 1 commit into
Conversation
Two fixes to the generic document list, both surfaced by the internal CRM's Lead list — where the built-in Draft/Submitted/Cancelled status dropdown is meaningless (Lead.status is a business field, not a docstatus) and the date pickers did nothing. - listFilters: a doctype config may declare `listFilters: string[]` — select fields rendered as dropdowns whose selection is sent as a plain column filter (status=Contacted, fit=A), via the ad-hoc filter path from 0.6.0. When set they replace the default status dropdown; omit to keep it. No backend change; existing doctypes unchanged. - date_field: from_date/to_date filtered against a hardcoded server DATE_FIELDS map that only knew core doctypes, so a plugin doctype's date pickers were silently dropped. The frontend now passes its declared dateField as a `date_field` param; the backend honors it when it's a real column (map fallback otherwise; degrades to no date filter, never a 400, for a synthetic field). Validated against live columns before touching SQL. Applies to list, count, and prev/next (DocPager) alike. tests/test_adjacent.py gains date_field coverage (list/count/adjacent + the graceful-degrade path). Full suite green on SQLite; CI covers Postgres. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jcfrei
added a commit
that referenced
this pull request
Jul 29, 2026
feat(list): config-driven filters + working date range on any doctype (#10) - listFilters config option → dropdowns from a field's select options, sent as column filters; replaces the default Draft/Submitted/Cancelled status dropdown where opted in. No backend change; existing doctypes unchanged. - date_field: frontend passes its declared dateField so from_date/to_date filter the right column on any doctype (list, count, and DocPager prev/next), instead of only the hardcoded core DATE_FIELDS map. Validated against live columns; degrades to no date filter for a synthetic field rather than 400-ing. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
|
Squash-merged into master as e231076 and released as v0.6.6. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Surfaced by the internal CRM's Lead list, where the generic document list's filter bar was wrong in two ways:
Draft / Submitted / Cancelled(docstatus labels). Leads aren't submittable —Lead.statusis a business field (New / Contacted / Responded / …), so picking "Draft" matched zero rows.from_date/to_datefilter against a hardcoded server-sideDATE_FIELDSmap that only knows the built-in core doctypes."Lead"isn't in it, so the range was silently dropped.Both live in core because the Lead list is the generic
DocumentList+ generic list endpoint.What
listFilters— a doctype config may declarelistFilters: string[]:selectfields rendered as dropdowns above the list, each selection sent as a plain column filter (status=Contacted,fit=A) via the ad-hoc column-filter path added in 0.6.0. When set, these replace the default status dropdown; omit it and every existing doctype is unchanged. No backend change.date_field— the frontend now passes its declareddateFieldas adate_fieldquery param. The backend honors it when it names a real column (falling back to theDATE_FIELDSmap otherwise, and degrading to no date filter — never a 400 — for a syntheticdateField). Validated against live columns before it touches SQL. Applies to list, count, and prev/next (DocPager) alike, so a filtered list and its DocPager stay in sync.Tests
tests/test_adjacent.pygainsdate_fieldcoverage: list + count + adjacent honor an explicit date column, the unmapped-doctype case is ignored, and a bogusdate_fielddegrades gracefully instead of 400-ing. Full suite green on SQLite; CI runs it on Postgres too.🤖 Generated with Claude Code