Commit graph

512 commits

Author SHA1 Message Date
Sagar Vora
49d33a7b3a fix: stricter link field assertion 2025-12-29 16:35:51 +05:30
Aarol D'Souza
15e59a3ba2
fix(postgres): add rollback to prevent crash on hash collision (#34686)
* fix(postgres): add rollback to prevent crash on hash collision

* fix(postgres): rollback to savepoint to prevent crash on hash collision

* fix(postgres): tighten bounds for a rollback to savepoint for a better perf

* fix(postgres): Handle hash collision efficiently with ON CONFLICT

* refactor: better naming

- Private methods
- "rows" is not a correct name for single record's name

* fix: Bad error handling

- Why raise postgres error?
- Let default error raising/handling happen

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2025-12-05 12:02:10 +05:30
Sagar Vora
a93530e221 Merge branch 'develop' into computed_child_table 2025-10-14 12:53:32 +05:30
Sagar Vora
a084f5a2f3 refactor: separate only computed CTs, with new include_computed flag 2025-10-14 12:31:47 +05:30
Sagar Vora
ae21d544a5 fix: add fallback when getting children in as_dict 2025-10-13 11:48:03 +05:30
Sagar Vora
e5a9e5bf74 fix: use ignore_virtual 2025-10-01 12:49:49 +05:30
Sagar Vora
66e187daa0 fix: dont pickle _parent_doc 2025-10-01 12:39:02 +05:30
Sagar Vora
2c9c6c0fd5 fix: correct table_fields references 2025-10-01 12:25:00 +05:30
Ejaaz Khan
4942cdc289 fix: add default value none 2025-09-19 14:43:45 +05:30
Ejaaz Khan
e69b607aab feat: add validation to prevent changing values on save 2025-09-19 11:21:40 +05:30
Sagar Vora
dddfe7a02f fix: more foolproof implementation for virtal ct 2025-09-10 13:27:35 +05:30
Sagar Vora
bdcd7c8eed
Merge pull request #33956 from sagarvora/extend_doctype_class
fix: minor improvements to extended class logic
2025-09-09 06:18:52 +00:00
Sagar Vora
c5bc3875df fix: minor improvements to extended class logic 2025-09-09 11:15:17 +05:30
Sagar Vora
d81cf3856c
Merge pull request #33943 from sagarvora/extend_doctype_class
feat: new `extend_doctype_class` hook
2025-09-08 13:54:41 +00:00
Sagar Vora
b4bd4f756d fix: set __module__ in extended class 2025-09-08 18:37:41 +05:30
Sagar Vora
18e2e61cad feat: support pickling extended class 2025-09-08 18:25:18 +05:30
Sagar Vora
1ff85611ff feat: new extend_doctype_class hook 2025-09-08 17:02:34 +05:30
barredterra
b1c7821911 feat: validate IBAN in backend 2025-08-29 15:21:56 +02:00
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