Commit graph

2467 commits

Author SHA1 Message Date
AarDG10
58d8859ddb fix: revert some changes 2026-05-01 18:41:02 +05:30
Aarol D'Souza
8b47c6e5a0
Revert "fix(query): unique aliasing for linked field joins" 2026-05-01 18:15:23 +05:30
AarDG10
efcd5011fa test: add test for limit offset behavior 2026-04-30 11:09:47 +05:30
AarDG10
2ea2c68e6e test: fix tests to accomodate new change 2026-04-28 19:46:11 +05:30
AarDG10
8b763e96e3 test: fix test to accomodate multi-db queries 2026-04-28 18:23:40 +05:30
AarDG10
9bcac62d98 fix(standard_macros): escape fields in standard print format template
Escaping on output, and reverting changes made in formatters.py.
2026-04-28 08:12:16 +05:30
Aarol D'Souza
cdc6dca582
Merge pull request #38835 from AarDG10/fix-formatters
fix(formatters)!: escape input fields
2026-04-27 12:26:38 +05:30
AarDG10
7693e6970d test(formatter): add test to check escaping 2026-04-27 12:06:20 +05:30
AarDG10
455595f2f5 refactor(test): minor refactor and added test to check query 2026-04-25 12:42:57 +05:30
vijayanrxbb
55e342bbd5 test(db_query): assert self-referential Link joins don't collide on alias
Mirrors test_ambiguous_linked_tables but with a DocType whose Link
fields point back to itself, covering the path where pypika's '2'
auto-alias collides on the second self-join.
2026-04-25 12:42:57 +05:30
Ankush Menat
098a0851c6
ci: Fix coverage reporting (again) (#38849)
* chore: remove _decorate_all_methods_and_functions_with_type_checker

No one understands this runtime magic anymore.

* build: Bump coverage.py to latest

* test: Skip github in coverage reporting

* test: Print traceback from all threads when test is stuck

* ci: Enable coverage in server side tests

* ci: Always enable coverage

It's cheap in recent python versions, our reasons for selectively
disabling aren't valid anymore.

* ci: Disable stderr capturing

* ci: Use default buffer behaviour in unittest runner

* ci(coverage): Set concurrency to multiprocessing

We do use multiprocessing, perhaps the patches aren't concurrectly
handled?

* ci(coverage): Try parallel run

* fix: Apply subprocess patch

* ci: Don't start web server with coverage

Causes deadlock for some reason. We don't actually report it either.

* ci: only submit UI coverage if ran

* test: remove aggresive stuck test checking

* ci: disable UI coverage

(for now)
2026-04-24 16:05:14 +05:30
Ejaaz Khan
be6e85fe9e
Merge pull request #38748 from barredterra/fix/test-runner-missing-doctype
fix(tests): skip uninstalled doctypes in test record dependency walk
2026-04-23 23:21:48 +05:30
Saqib Ansari
a8c373a2f4
Merge pull request #38576 from nextchamp-saqib/concurrent_limit
feat: add `@frappe.concurrent_limit()` decorator
2026-04-23 22:55:59 +05:30
Saqib Ansari
01de388c26
Merge pull request #38800 from nextchamp-saqib/qb-json-functions
feat: add JSON functions in query builder
2026-04-23 22:50:47 +05:30
Saqib Ansari
9d3f410037 feat: add tests for JSON functions 2026-04-23 10:29:58 +05:30
Saqib Ansari
0064eb80b4 fix: support shared RedisSemaphores for concurrency limits 2026-04-22 16:20:54 +05:30
Abdeali Chharchhodawala
690826ff9b
feat!: faster generation and formatting utils for excel exports (#36323)
* feat: Style builder for report xlsx formatting

* fix: update report to use direct import for query report execution

* refactor: simplify module method retrieval in report execution

* feat: get xlsx styles for report

* refactor: enhance XLSXStyleBuilder with currency formatting and default style registration

* feat: add xlsxwriter dependency for enhanced XLSX report generation

* refactor: enhance XLSXStyleBuilder with improved style registration and formatting methods

* feat: enhance XLSX export functionality with improved styling and metadata support

* refactor: default formatting of currency

* chore: remove some typo

* feat: update make_xlsx function to use xlsxwriter for improved Excel file generation and styling

* perf: some micro optimisations

* refactor: inline generator back and improve condition

* refactor: replace frappe.request_cache with functools.cache

* fix: handle styling in email

* fix: fix old test case to handle styles in export

* refactor: enhance XLSX style handling and registration methods

* refactor: improve currency formatting logic

* fix: update make_xlsx to use constant_memory for large datasets and improve row style handling

* fix: handle None style_id in XLSXStyleBuilder methods to prevent errors

* fix: include owner field with proper doctype naming

* fix: set default date format in XLSX workbook creation

* fix: pass applied filters to metadata

* fix: getting accurate field info for report view exporting

* chore: Minor changes

* feat: add function to generate default XLSX styles for exports

* feat: integrate default XLSX styles into builder report export functionality

* feat: styles on export docs xlsx

* feat: enhance make_xlsx function to support file path saving

* feat: add make_xls function for creating Excel files in old format and improve sheet name sanitization

* fix: handle default date formatting

* refactor: changes xlsx builder usage

* refactor: update xlsx style builder usage

* refactor: enhance field info retrieval with default field support

* fix: handle update key in report data

* refactor: enhance get_field_info to include options and improve label retrieval

* fix: improve error handling for unsupported file formats and ensure applied filters are set correctly

* refactor: update XLSX header index handling and improve metadata structure

* fix: handle currency formatting in reportview export

* fix: update default date format to datetime format in XLSX creation

* fix: update serial number field in auto email report to use 'sr' instead of 'idx'

* fix: enhance XLSX styling by adding right alignment for specific field types

* chore: remove unused code

* fix: update XLSXMetadata attributes for improved report styling options

* perf: further improve currency styling

* fix: correct column index mapping in XLSX export header

* refactor: optimize indentation style registration in XLSXStyleBuilder

* perf: improve apply_indentations

* fix: reduce more attr lookup

* refactor: remove duplication

* fix: use report name in XLSX export instead of hardcoded title

* fix: remove ignore_visible_idx from XLSXMetadata

* fix: review

* fix: update XLSX style fetching logic in build_xlsx_data function

* fix: add right alignment to date, time, and datetime styles in XLSXStyleBuilder

* fix: simplify number format handling in XLSXStyleBuilder

* fix: register common styles in XLSXStyleBuilder for improved style management

* test: add tests for XLSX styles structure and fieldtype column styles in XLSXStyleBuilder

---------

Co-authored-by: Sagar Vora <16315650+sagarvora@users.noreply.github.com>
2026-04-21 19:07:43 +05:30
barredterra
38e140df22 fix(tests): skip uninstalled doctypes in test record dependency walk
The test runner walks link-field dependencies recursively to pre-generate
test records via `get_missing_records_doctypes`. If any DocType in the
transitive link graph belonged to an app not installed on the test site,
the walk crashed with `DoesNotExistError`, aborting the entire suite
before a single test ran.

Treat such link targets as dead-end leaves instead:

- `get_modules` now returns `(None, None)` when the DocType row does not
  exist, instead of falling through into `load_doctype_module` which
  raises.
- `get_missing_records_doctypes` checks for `module is None`, logs a
  warning naming the parent DocType that linked to it, and returns
  without descending further.

This restores the ability to run downstream test suites that link
(directly or transitively) to optional/uninstalled apps without forcing
every CI environment to know the full transitive link graph.

Fixes #38747
2026-04-21 01:49:08 +02:00
Saqib Ansari
4eafb38f98 test: rewrite concurrent_limit tests to test through public interface 2026-04-18 14:58:47 +05:30
Saqib Ansari
e8c7eb946b refactor: rewrite concurrent_limit to use LIST + BLPOP semaphore
Replace the INCRBY-based polling loop with a proper token pool backed by
a Redis LIST. BLPOP blocks until a token is available instead of sleeping
and retrying, which is more efficient and avoids the check-then-act race
of the old counter approach.

Other fixes bundled in:
- Add `blpop` and `setnx` wrappers to `RedisWrapper` so all key prefixing
  goes through `make_key` consistently
- Cache `_default_limit()` result with `@redis_cache(shared=True)` to
  avoid importing `multiprocessing` on every request
- Fix `limit=0` edge case: use `is not None` guard instead of falsy check
- Guard `_release()` against pushing the `"fallback"` token back into the
  pool when Redis was unavailable during acquire
2026-04-18 14:21:33 +05:30
Shrihari Mahabal
16440d71e9
Merge pull request #37861 from ShrihariMahabal/get-docs
feat: get_docs to fetch instantiated document objects from db
2026-04-15 11:24:21 +05:30
Saqib Ansari
18d73d8045 fix: tests 2026-04-14 11:07:48 +05:30
Saqib Ansari
76eb3297cd refactor: set Retry-After header directly 2026-04-10 22:43:45 +05:30
Saqib Ansari
2f30dac5d8 feat: implement concurrency limiting decorator 2026-04-10 22:22:23 +05:30
Ankush Menat
8a0825fe6d test: don't hardcode throw-away doctype names 2026-04-08 21:31:04 +05:30
Ankush Menat
a303fbc3ea refactor: Consistent API for list/generator
Returning chunks is not expected API. Why? Because we should always be
able to do:

```python
for doc in frappe.get_docs(...):
    ...
```
2026-04-08 21:31:02 +05:30
Ankush Menat
0d833d658e refactor: use as_iterator instead of as_generator
Because it's already used in `db.sql`. So use consistent naming.
2026-04-08 21:17:25 +05:30
Kaushal Shriwas
51cfc8181e
perf(query): replace Coalesce with OR IS NULL in func_in (#38336) 2026-04-08 10:57:07 +05:30
Ankush Menat
0ae52b051e test: use another doctype to avoid test pollution 2026-04-08 10:50:47 +05:30
Ankush Menat
0d8ddb5958 Merge branch 'develop' into get-docs 2026-04-08 10:50:31 +05:30
Aarol D'Souza
0afbf2a98e
Merge pull request #38316 from AarDG10/feat-qb-gc
feat(custom): add separator support for Group_concat in Mariadb
2026-03-30 20:11:47 +05:30
AarDG10
12e8995640 test: add and update group_concat test for mariadb
Updated test, since have decided to keep separator ',' as default for the query generation.
2026-03-29 18:03:21 +05:30
Hussain Nagaria
ac3d5ee115
Merge pull request #38128 from kaulith/fix/qb-in-filter-none-handling 2026-03-27 18:12:11 +05:30
Sagar Vora
2a2350d3a4 test: ensure fields with accented chars are considered valid 2026-03-26 17:25:51 +05:30
Kaushal Shriwas
c8ce8cdc23 test(query): remove manual commit from test 2026-03-26 12:45:05 +05:30
Kaushal Shriwas
d609b8e2cc test: add test cases 2026-03-21 15:00:59 +05:30
Kaushal Shriwas
6281eac44a test: add unit test 2026-03-20 12:27:54 +05:30
mergify[bot]
1907293ba7
Merge branch 'develop' into get-docs 2026-03-19 11:48:31 +00:00
Shubh Doshi
5092225cbc
fix!: prevent submission of non-submittable doctype (#37009)
* fix: prevent submission of non-submittable doctype

* fix: updated failing test cases to use submittable doctype as required

* refactor: corrected to_docstatus and from_docstatus use

* fix: inherit submittability from parent for child tables

* Revert "fix: inherit submittability from parent for child tables"

This reverts commit ee83ee59b4f0596e2d402a1547e92b131ae49579.

* feat: introduce skip_docstatus_validation flag

* test: add test cases for skip_docstatus_validation flag and docstatus transition of non-submittable doctype
2026-03-12 17:24:21 +05:30
Ejaaz Khan
e7b4bd5666
fix: ignore fieldname validating ignore_user_permissions for Link fields (#37942)
* fix: validate ignore_user_permissions for alternative Link fields

* fix: handle alternative Link fields with ignore_user_permissions

* fix: move early exit earlier to avoid edge cases

* test: validate case of bulk edit

---------

Co-authored-by: Sagar Vora <sagarvora@users.noreply.github.com>
2026-03-11 20:54:03 +00:00
Sagar Vora
7a113c0aee
fix: use correct core doctypes set in _get_filterable_fields (#37932) 2026-03-11 17:19:48 +05:30
RitvikSardana
5168c52ebe
refactor: add queue for indexing docs in sqlite search (#37840) 2026-03-10 16:03:27 +05:30
Shrihari Mahabal
e2fef24a08 test: add tests for get_docs 2026-03-09 12:31:08 +05:30
Shrihari Mahabal
ab6806a876 test: modify existing flush and send_after email tests to add delay to flush 2026-03-05 12:43:02 +05:30
Ankush Menat
657b1eb50c
fix!: Restrict allowed HTML in msgprints (#37399)
Co-authored-by: AarDG10 <aarol.dsouza@gmail.com>
2026-02-23 11:49:15 +00:00
Kerolles Fathy
a71134ee2b
fix(DX): Add patches folder when generating new app boilerplate (#37352)
* fix(DX): add patches folder creation when generating new app boilerplate

* test: add patches folder to paths_inside_app
2026-02-23 11:08:20 +05:30
Suraj Shetty
0c211aa4a0
Merge pull request #35940 from AarDG10/fix-orderby-pg 2026-02-22 13:09:43 +05:30
AarDG10
93952e8c98 test: fix test to suit the changes 2026-02-22 11:35:19 +05:30
Sagar Vora
95283be9f5
Merge pull request #37316 from sagarvora/fix/select-permission-filter-fields
fix: allow filtering by all permlevel 0 fields with select permission
2026-02-20 21:34:06 +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