Commit graph

299 commits

Author SHA1 Message Date
Aarol D'Souza
8b47c6e5a0
Revert "fix(query): unique aliasing for linked field joins" 2026-05-01 18:15:23 +05:30
AarDG10
d6adf919c9 fix(query): use default limit when offset is used in MariaDB and SQLite
MariaDB and SQLite don't allow use of offset as a standalone, limit is a must, enforcing that in QB. PostgreSQL allows use of offset w/o limit clause.
2026-04-30 10:42:35 +05:30
AarDG10
fd2661160e fix(query): always alias the table when used in joins 2026-04-28 17:52:20 +05:30
vijayanrxbb
383b24e0f9 fix(db_query): unique alias on self-referential Link joins
When a DocType has two or more Link fields pointing back to itself and
list view tries to join them, pypika auto-aliased both joins with the
same '<table>2' suffix, producing a MySQL 1066 'Not unique table/alias'
error.

Alias each self-referential join with 'tab<doctype>_<link_fieldname>'
so every join gets a unique alias, and use the same aliased table in
apply_select so SELECT references resolve correctly.
2026-04-25 12:42:57 +05:30
Ejaaz Khan
ada4df8f0f
Merge pull request #38282 from iamejaaz/sticky-header
feat: sticky header on list view
2026-03-27 00:32:14 +05:30
Ejaaz Khan
21a2dd5057 fix: precommit errors of parenthesized 2026-03-27 00:15:31 +05:30
Sagar Vora
17f9ca9819 fix: check for numeric arg first 2026-03-26 17:25:13 +05:30
Sagar Vora
0d415afdd5 fix: allow unicode chars in field regexes 2026-03-26 17:02:12 +05:30
Priyal
d6fdcdb832 refactor: update permission check method 2026-03-17 18:17:38 +05:30
Priyal
aef4d4bfc3 fix: check only select perm instead of read or select 2026-03-17 18:17:38 +05:30
Akhil Narang
e2fe249706
Merge pull request #37903 from akhilnarang/qb-fixes
fix: some follow up fixes for query builder
2026-03-13 13:36:48 +05:30
Akhil Narang
72007f636d
fix(query): ensure atleast name is always selected
Otherwise we got an empty query if we tried to only query a child table

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2026-03-13 10:23:27 +05:30
Akhil Narang
a084bad5d5
fix(apply_field_permissions): improve checks
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2026-03-13 10:23:27 +05:30
Sagar Vora
7a113c0aee
fix: use correct core doctypes set in _get_filterable_fields (#37932) 2026-03-11 17:19:48 +05:30
Akhil Narang
3e4f139ff3
fix: use string representation of exceptions in translated strings (#37756)
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2026-03-06 13:02:16 +05:30
Suraj Shetty
0c211aa4a0
Merge pull request #35940 from AarDG10/fix-orderby-pg 2026-02-22 13:09:43 +05:30
Sagar Vora
369f15ac09 fix: allow filtering by all permlevel 0 fields with select permission
Users with only 'select' permission can now filter, order by, and
group by all permlevel 0 fields, not just search fields.

- Added _get_filterable_fields() returning all permlevel 0 fields
  for select permission users
- Split permission checking into check_select_field_permission()
  and check_filter_field_permission()
- select field validation uses check_select_field_permission
- Filter/order/group by validation uses check_filter_field_permission
2026-02-20 21:23:29 +05:30
Aarol D'Souza
a043c26709
Merge pull request #35318 from AarDG10/add-custom-hook
feat(server script): parse child table list onto server script for customizations
2026-02-17 23:05:32 +05:30
Diptanil Saha
a93b84df3c
fix(query_builder): added validation to check DocType name (#36878)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2026-02-09 15:24:58 +05:30
Suraj Shetty
cefac6851e
Merge pull request #36621 from frappe/fix-empty-list-in-operator-behavior
fix!: Enhance IN/NOT IN operator handling for empty lists
2026-02-09 15:17:54 +05:30
AarDG10
7d31c299eb refactor: minor refactors 2026-02-06 22:11:34 +05:30
Sumit Jain
c6868b11c6 feat: Enhance IN/NOT IN operator handling for empty lists
Added logic to return appropriate criteria for empty lists in IN and NOT IN operators. An empty list with IN now returns 0 results (1=0), while NOT IN returns all results (1=1). Updated tests to verify this behavior.
2026-02-03 12:31:29 +05:30
Akhil Narang
3d66341ee2
feat(qb): implement build_match_conditions, build_filter_conditions (#35857)
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2026-02-03 12:10:38 +05:30
Aarol D'Souza
a74725f826
Merge branch 'develop' into add-custom-hook 2026-01-30 23:32:46 +05:30
AarDG10
edd15715b6 feat(query): parse child tables via query file too 2026-01-30 23:25:26 +05:30
Aarol D'Souza
95450c85bd chore: resolve conflicts 2026-01-27 19:57:50 +05:30
AarDG10
5c31a7d020 refactor: better variable naming 2026-01-22 10:50:20 +05:30
AarDG10
0654de7e98 fix(query): fix ifnull fallback in postgres 2026-01-22 00:26:31 +05:30
AarDG10
ab2a9f8134 refactor: reduce unnecessary noise in code 2026-01-15 22:55:52 +05:30
AarDG10
4530996223 revert(validation): revert validation due to breakage in old queries 2026-01-15 22:35:39 +05:30
AarDG10
c35f271144 refactor: perform validation only once 2026-01-15 22:21:00 +05:30
AarDG10
151fc37fbd fix(validation): maintain compatibility with different way of writing queries 2026-01-15 19:02:05 +05:30
AarDG10
66c870d730 feat(dx): add validation to check if selected fields are grouped or aggregated for a better dev experience 2026-01-15 18:11:32 +05:30
AarDG10
92e0a215b0 refactor: better naming for tracking grouped fields 2026-01-15 12:59:49 +05:30
AarDG10
fd5da930f3 fix(query): ensure aggregate queries without group_by trigger postgres sort normalization 2026-01-14 19:21:24 +05:30
AarDG10
50e675f009 refactor: update warning to apply only to select distinct queries 2026-01-14 18:33:40 +05:30
AarDG10
cb68c2df32 fix(query): aggregate order_field when used with select group_by 2026-01-14 14:14:59 +05:30
Akhil Narang
c2e2ca611a
fix(query): handle string argument with between
Prevents crash when filter value doesn't exist (example, invalid Fiscal Year)

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2026-01-08 16:34:27 +05:30
Akhil Narang
fb07cf7579
fix(query): don't crash for invalid value
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2026-01-08 16:33:40 +05:30
AarDG10
54da011c65 fix(query): check hooks for custom_operator definition 2026-01-07 20:42:24 +05:30
Akhil Narang
d02d89436e
fix(qb): support reportview alias format
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2026-01-06 19:30:14 +05:30
Sagar Vora
9a774de21e
fix: add permission conditions to where clause instead of join 2026-01-05 13:32:04 +00:00
Akhil Narang
0661fa3f60
Merge pull request #35538 from akhilnarang/ignore-filter-fifth-parameter
fix(query): ignore 5th filter parameter
2025-12-30 17:59:42 +05:30
Akhil Narang
92900d366c
refactor: simplify code using match
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-12-30 16:54:59 +05:30
Akhil Narang
038bd44d08
fix(query): ignore 5th filter parameter
It doesn't do anything, but many old charts, etc. still have it present, no point erroring out.

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-12-30 16:30:42 +05:30
Sagar Vora
c9147fb840 chore: improve docstring 2025-12-30 13:25:13 +05:30
Sagar Vora
9fd5106ad1 fix: specify correct doctype in _raise_permission_error 2025-12-30 13:21:49 +05:30
Sagar Vora
26b3e6363e chore: deprecate validate_filters 2025-12-30 13:02:49 +05:30
Sagar Vora
0a76f1fc36
Merge branch 'develop' into qb-fixes 2025-12-29 15:43:32 +05:30
Akhil Narang
3881a7ae7e
fix(query): check parent permissions when querying child table fields
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-12-22 12:48:35 +05:30