Commit graph

494 commits

Author SHA1 Message Date
Maverjk Carter
a9562f6182 fix: check if df exist before accessing its properties 2025-07-31 12:04:15 +05:30
Raffael Meyer
93b4700899
fix: make labels in error message translatable (#33166) 2025-07-23 18:11:51 +05:30
Sagar Vora
b3e1eda4c8
feat: global frappe.in_test flag (#32960)
* feat: global `frappe.in_test` flag

* feat: helper utility to toggle `frappe.in_test`

* fix: use `toggle_test_mode` util

* fix: use `frappe.in_test`

* chore: add comment explaining global `in_test`

* chore: ignore commit replacing flag usage

* test: temporarily disable `frappe.in_test`

this worked earlier because flag was set in werkzeug.local which was separate for API test client

* test: add comment explaining change
2025-06-17 19:19:31 +05:30
Ankush Menat
e4bc7f361b
Revert: DocRef (#32866)
- Hardly used anywhere
- Too many hardcoded `__value__` calls without which it's not usable.
- Another type to worry about
2025-06-10 05:20:56 +00:00
Ankush Menat
22827056ce fix: Assert type of link field values 2025-06-10 10:10:51 +05:30
Ankush Menat
8c1ee68ce6
perf: Skip order_by in link validation (#32848)
~10% faster because no QB overhead
2025-06-09 07:35:00 +00:00
Ankush Menat
515d9006a4 refactor: simplify link field checks
Also: perf: only fetch docstatus if required

This will let us do index-only scans.
2025-06-05 21:38:12 +05:30
Ankush Menat
4dd21f175e perf: Avoid seprately fetching docstatus 2025-06-05 15:24:29 +05:30
Ankush Menat
c434f4ca14 Revert "Revert "perf: cache fetch from value too (#32700)" (#32708)"
This reverts commit 8a3f65338c.
2025-06-05 15:24:29 +05:30
Ankush Menat
a3d5b4af77
Revert "perf: cache docstatus check for invalid links" (#32799)
This reverts commit be5c96acf22f208c4ec8fbcde92a721b0e84d561.
2025-06-05 08:52:57 +00:00
Ankush Menat
7d7d77d762
perf: misc small cruft (#32778)
* perf: cache docstatus check for invalid links

* perf: avoid querying if doctype is single

* perf: cache is_single
2025-06-04 19:18:19 +05:30
Ankush Menat
8a3f65338c
Revert "perf: cache fetch from value too (#32700)" (#32708)
This reverts commit f8e9e82260.
2025-05-28 13:31:07 +00:00
Ankush Menat
ba96408d23
fix: checkboxes can never be mandatory (#32707) 2025-05-28 13:24:49 +00:00
Ankush Menat
f8e9e82260
perf: cache fetch from value too (#32700)
Consider any "items" table in ERNext, same item and warehouses are used
10s of times in a single document, every one of them triggers fetch from
query, even though it can't possibly change during the DB transaction.

This change now caches the fetched value too.
2025-05-28 15:56:52 +05:30
Akhil Narang
9e6a73f7c2
Merge pull request #31156 from akhilnarang/sqlite
feat: sqlite support
2025-04-16 08:56:52 +05:30
Ankush Menat
56e2a9ad2d
Revert "fix(HTML Editor): extraction of images" (#32129) 2025-04-15 22:21:40 +05:30
Akhil Narang
9fa330c075
fix(sqlite): use correct check for unique/primary key constraint violations
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-04-15 13:59:17 +05:30
Sagar Vora
7421ffa79a feat: use cached_property without locks on all supported Python versions 2025-04-11 13:21:27 +05:30
Sagar Vora
2a2700970d perf: pre-create UnionType objects 2025-03-20 21:34:07 +05:30
Sagar Vora
36b2d47c14
Merge pull request #31750 from sagarvora/perf-as_dict-
perf: reduce repeated attribute access in `as_dict`
2025-03-17 09:26:01 +05:30
Sagar Vora
2414647964 perf: reduce repeated attribute access in as_dict 2025-03-17 09:15:55 +05:30
Sagar Vora
c7a037c3e4 perf: doc.permitted_fieldnames is now a set 2025-03-17 09:02:25 +05:30
Sagar Vora
d50fdbe3bc perf: much faster doc.update 2025-03-16 13:58:45 +05:30
Sagar Vora
1da2706578 fix: allow user-defined __new__ 2025-03-16 11:13:01 +05:30
Sagar Vora
32ff002c32 fix: revert valid columns cache
it is used only once when initialising doc
2025-03-16 01:10:29 +05:30
Sagar Vora
63f2c35290 perf: preset _table_fieldnames for child docs 2025-03-16 00:59:10 +05:30
Sabu Siyad
e012213ca2
docs: base_document: remove(): comment to docstring (#31720) 2025-03-14 16:30:12 +01:00
Sagar Vora
ffba20a160 perf: faster _init_child 2025-02-25 14:01:09 +05:30
Sagar Vora
aae5860efc perf: faster init_valid_columns 2025-02-25 13:20:35 +05:30
Sagar Vora
c31cb69d5c fix: update reserved keywords 2025-02-25 12:00:51 +05:30
Sagar Vora
26b5d8de15 perf: better _table_fieldnames cache 2025-02-24 17:41:00 +05:30
Sagar Vora
fc7202ade4 perf: dont create a new weakref.ref for each child 2025-02-24 15:57:42 +05:30
Sagar Vora
fcf657ba80 perf: improved DocStatus API and other minor improvements 2025-02-24 12:51:10 +05:30
Sagar Vora
6ef67c7a38
Merge pull request #31357 from sagarvora/reqd-fields-only 2025-02-20 17:57:29 +05:30
Sagar Vora
ece9b6396d perf: get reqd fields only 2025-02-20 17:47:35 +05:30
Sagar Vora
2f9f659fcb perf(DX): always cache controllers 2025-02-20 17:43:12 +05:30
Ankush Menat
9c2bd23606
fix: don't override setstate (#29194)
Meta sometimes break because of this, I don't quite know why but this
change isn't that useful, so best to revert it for now.
2025-01-16 15:50:47 +05:30
ruthra kumar
cb89393d24 refactor: temporary key for child rows 2025-01-02 15:33:15 +05:30
Akhil Narang
2af6eedec9
Merge pull request #28873 from krantheman/fix-html-editor
fix(HTML Editor): extraction of images
2024-12-24 16:14:00 +05:30
Ankush Menat
3cb8a9e2e4
perf: cache dynamic links map in Redis (#28878)
Note about correctness: Once site has seen enough usage this map will rarely change. So the
problem of "cache inconsistency" is very rare, still care is taken to
avoid possible cache inconsistencies.
2024-12-23 19:43:05 +05:30
krantheman
bb38c62642 fix(HTML Editor docfield): extraction of images 2024-12-23 14:55:05 +05:30
Ankush Menat
7dd15e3613
perf: speedup pickling of document objects (#28823)
* perf: Use latest pickle protocol

* perf: pop flags from cached documents

This is also the right thing to do, things like `doc.flags.for_update`
shouldn't be "cached".
2024-12-18 10:18:04 +00:00
David Arnold
d5fd8d7c20
chore(docref): fix circular imports (#28282) 2024-10-24 22:31:12 +02:00
David Arnold
2abba7b51b
fix: don't force values into the string type (#28185) 2024-10-19 19:00:25 +00:00
David Arnold
7348572af8
feat: docref identifier / proxy (#27973)
* feat: add DocRef

* feat: Add comprehensive test cases for DocRef functionality

* chore(db): add field type hints

* fix: ensure document stringer fulfills the DocRef contract
2024-10-19 09:40:26 +05:30
Sumit Bhanushali
847dd62ec0 feat: permission log 2024-09-30 14:54:32 +05:30
Akhil Narang
8260574f0d
Merge pull request #27659 from barredterra/mandatory-field-msg
fix: message for missing mandatory fields
2024-09-24 20:37:48 +05:30
Raffael Meyer
c73734715d
fix: update message needed for test
Co-authored-by: Akhil Narang <me@akhilnarang.dev>
2024-09-24 16:28:04 +02:00
ruthra kumar
2b8df89d55 fix: re-number idx on child table row removal 2024-09-17 14:19:57 +05:30
barredterra
89443beb06 fix: message for missing mandatory fields 2024-09-05 10:45:32 +02:00