Commit graph

690 commits

Author SHA1 Message Date
Akhil Narang
2dcfe07ca8
refactor: make use of check_permission parameter for get_lazy_doc
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-12-10 16:52:26 +05:30
Akhil Narang
75b91f44ce
feat(get_lazy_doc): add in check_permission parameter
So as to avoid manually calling doc.check_permission() often

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-12-10 15:40:58 +05:30
Akhil Narang
40ebe6b97a
feat(get_doc): add in check_permissions parameter
If a string, we'll try to check for that permission
Otherwise, we'll just check for `read`
2025-12-09 19:31:14 +05:30
Raffael Meyer
afefeb5dc1
refactor: allow defer_insert in doc.log_error (#34631) 2025-11-07 12:35:50 +01:00
Sagar Vora
a93530e221 Merge branch 'develop' into computed_child_table 2025-10-14 12:53:32 +05:30
Sagar Vora
2a42f0688f chore: update docstring 2025-10-14 12:41:58 +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
3264fb0f12 fix: missing flag 2025-10-01 12:59:48 +05:30
Sagar Vora
4ba6855fff fix: reset virtual ct cache on save/insert 2025-10-01 12:28:45 +05:30
Sagar Vora
2c9c6c0fd5 fix: correct table_fields references 2025-10-01 12:25:00 +05:30
Ejaaz Khan
335c0d5f36 fix: refactor code and change field type 2025-09-30 12:38:39 +05:30
Ejaaz Khan
e69b607aab feat: add validation to prevent changing values on save 2025-09-19 11:21:40 +05:30
Ejaaz Khan
54b34c9535
Merge branch 'develop' into 32489-role-perm-based-masking 2025-09-17 16:17:30 +05:30
Sagar Vora
dddfe7a02f fix: more foolproof implementation for virtal ct 2025-09-10 13:27:35 +05:30
barredterra
76c04fef27 refactor: move virtual child table check into get_table_fields 2025-09-10 12:07:47 +05:30
Raffael Meyer
ee93a01106
Merge branch 'develop' into computed_child_table 2025-09-10 08:34:36 +02:00
Akhil Narang
5b26db7265
Merge pull request #33685 from AMR-Mannesmann/fix(document)-is_child_table_same-for-new-docs
fix(document): is_child_table_same for new docs
2025-09-02 11:37:06 +05:30
Ejaaz Khan
590fe7e520
Merge branch 'develop' into 32489-role-perm-based-masking 2025-09-02 10:48:06 +05:30
Akhil Narang
719af6e722
Merge pull request #33815 from raizasafeel/fix/translation-trailing-spaces
fix: remove trailing spaces in translatable strings
2025-08-28 16:31:45 +05:30
Raizaaa
aa3bb0e4d7 fix: remove trailing spaces in translatable strings 2025-08-27 13:23:17 +03:00
Mihir Kandoi
c24bda0481 feat: enable non negative validation for Percent type fields 2025-08-26 22:12:23 +05:30
Daniel Radl
99d6e1b381 fix(document): is_child_table_same for new docs 2025-08-20 09:30:26 +00:00
Ejaaz Khan
c2544f9096 refactor: change approach of masking fields 2025-08-18 23:38:18 +05:30
mergify[bot]
c0aa39ee9a
Merge branch 'develop' into 32489-role-perm-based-masking 2025-08-01 05:57:54 +00:00
Raffael Meyer
93b4700899
fix: make labels in error message translatable (#33166) 2025-07-23 18:11:51 +05:30
P-Froggy
00a5fde3ad
feat: Enable _doc_before_save for child documents (#33279)
* Initial Commit

* Apply suggestion from @ankush

* refactor: move unrelated code out of try-except block

* test: child table level value change detection

---------

Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
Co-authored-by: Ankush Menat <ankush@frappe.io>
2025-07-11 12:33:00 +00:00
Ankush Menat
b74b8f16b7
refactor: slim down init.py further (#33284)
* refactor: move document utils

* test: rewrite init.py test

The LOC is 1000 less than what it used to be.
2025-07-11 15:34:50 +05:30
Sagar Vora
71428b7dcb
feat: utility to commit certain queries after sending response (#32978)
* feat: utility to commit certain queries after sending response

* fix: add error handling

* refactor: subclass CallbackManager
2025-07-08 05:02:27 +00:00
Akhil Narang
ad948c9b98
Revert "Merge pull request #32327 from akhilnarang/allow-passing-name-in-api"
This reverts commit 1e30db26dc, reversing
changes made to 8da72e91e3.
2025-07-03 17:23:48 +05:30
Sagar Vora
406aae7432 chore: fix typo 2025-07-01 19:43:04 +05:30
Ejaaz Khan
cbcf16440a refactor: remove masking setting from System Settings 2025-06-26 13:06:44 +05:30
mergify[bot]
0312cb7eb4
Merge branch 'develop' into 32489-role-perm-based-masking 2025-06-25 17:17:30 +00:00
Ankush Menat
3d50221762 fix: Don't lazy load virtual tables 2025-06-25 17:59:48 +05:30
Ankush Menat
bb58e7aebe fix: Don't update computed tables 2025-06-25 17:24:38 +05:30
Ankush Menat
17324982b5 fix: force virtual field too 2025-06-25 17:24:38 +05:30
Ankush Menat
388d8b2bc7 feat: Computed/virtual child-tables
- They need to be a non-data descriptor i.e. cached_property or
  equivalent
- When "loading from DB", we will trigger the descriptor
- The descriptor can return dict or docs for better DX.
- We initialize docs as normal child tables
2025-06-25 17:24:37 +05:30
Faris Ansari
09ae9ad086 fix: rename method typing 2025-06-18 15:51:13 +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
Sagar Vora
5210348322 perf: assume key to be table fieldname 2025-06-14 01:49:07 +05:30
Sagar Vora
d79ca9560b chore: revert _init_* methods of document 2025-06-13 22:24:03 +05:30
Ejaaz Khan
2ad1217fb0
Merge branch 'develop' into 32489-role-perm-based-masking 2025-06-11 19:47:48 +05:30
Ankush Menat
b162c0d6ec
fix!: Don't update document from keyword args (#32898)
Right now if you do this:

`get_doc(doctype, name, field=value)` then it loads document from DB and
then updates field to value.

This is absurd API and I don't think it was ever done intentionally.
2025-06-11 10:15:35 +00:00
Ankush Menat
44681433c9
fix: for_update for lazy loaded documents (#32897)
* fix: Support for_update on lazy documents

* fix: Pop for_update from arguments

* fix: Don't init empty child tables
2025-06-11 10:02:36 +00:00
Sagar Vora
a6b2f7c991
perf: dont override doc.extend (#32890) 2025-06-11 07:26:46 +00:00
Ankush Menat
893a87df86 fix: append and extend without touching attributes 2025-06-11 10:07:48 +05:30
Ankush Menat
10c3c9ea9b fix: Limit getattr to lazy loaded child tables only 2025-06-11 09:55:45 +05:30
Ankush Menat
5c886ef091 test: test internal implementation of LazyChildTable 2025-06-11 09:55:45 +05:30
Ankush Menat
26cf77562c refactor: rearrange checks, inline and cast super args
Co-authored-by: Sagar Vora <16315650+sagarvora@users.noreply.github.com>
2025-06-11 09:55:45 +05:30
Ankush Menat
e69f79e2ae fix: Support dict as key ~ filters
Triggers full fetch indirectly, but there's no other option for this.
2025-06-11 09:55:45 +05:30
Ankush Menat
bebabc3211 fix: Handle support for DocType and virtual
By falling back to original impl with warning.
This is just to allow "fearless usage".
2025-06-11 09:55:45 +05:30