Commit graph

2441 commits

Author SHA1 Message Date
Akhil Narang
23be301046
Merge pull request #25902 from akhilnarang/minor-cleanup
chore: minor code cleanup
2024-04-12 11:21:38 +05:30
Akhil Narang
306c923986
chore: minor code cleanup
- Use walrus operator where possible
- Drop redundant checks - we anyway can't iterate over an empty list

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-04-10 17:22:45 +05:30
Ankush Menat
caf7aec286
feat(APIv2): Add comment via REST API (#25889)
```
POST /document/Sales Order/S0-123/add_comment
{
    text: "Comment"
}
```
2024-04-10 10:53:22 +00:00
Revant Nandgaonkar
7e16e902d9
feat: allow wildcard for doctype in permission hooks (#25729)
* feat: allow wildcard for doctype in permission hooks

* fix: pass doctype to permission query

* fix: combine methods instead of alternate

* test: wildcard has_permssion hook

* test: wildcard has_permssion make note public

* fix: fetch list of hooks once
2024-04-10 11:44:37 +05:30
Ankush Menat
b493bfe7c2 fix(DX): annotate chainable methods with Self return 2024-04-06 11:04:55 +05:30
Ankush Menat
30f00fd5f3 fix: invlaid integer validations for biging
closes https://github.com/frappe/frappe/issues/25566
2024-04-06 11:04:55 +05:30
Ankush Menat
1ec4d658fc fix: Allow setting UUID to application code 2024-03-29 19:02:28 +05:30
Ankush Menat
6c79a13641 feat: UUID naming support 2024-03-29 19:02:28 +05:30
Ankush Menat
87ffe25e71
fix: reserved keywords as col name (#25718) 2024-03-29 15:43:33 +05:30
Ankush Menat
23204c0c05
Merge pull request #25256 from ankush/no_commit_doc_events
fix: disable transaction commits during doc events
2024-03-28 12:28:12 +05:30
Ankush Menat
f66b23b96d fix: handle nested event calls
Treat disable_transaction_control as a stack incr/decr when moving in
and out of context.
2024-03-28 11:27:24 +05:30
Ankush Menat
432c8cf48c
Merge pull request #25624 from ankush/creation
fix!: Switch to `creation` as default sort order
2024-03-27 13:25:53 +05:30
Ankush Menat
ff1f8ddbda
fix: allow any sequence container (#25664) 2024-03-27 06:31:15 +00:00
Ankush Menat
dbcf7ad30c refactor: update usage of modified everywhere 2024-03-27 11:23:13 +05:30
Ankush Menat
071e269548 fix!: Switch to creation as default sort order 2024-03-27 11:18:28 +05:30
Dany Robert
6e02df7ea2
fix: ordered fields on get_list returning list (#25663)
* fix: ordered `fields` on get_list returning list

* chore: linters
2024-03-27 05:11:09 +00:00
Ankush Menat
76096f5fb8
perf: use meta for virtual and single checks (#25620)
RQ workers spawn a new process for every job so site_cache does
nothing to prevent repeated queries.
2024-03-26 13:10:15 +05:30
Ankush Menat
a12fc118f4
perf: remove useless sorting on docstatus (#25571) 2024-03-21 06:17:23 +00:00
Ankush Menat
f642b1881f fix: invalid select star expansions 2024-03-20 16:31:02 +05:30
Ankush Menat
065674236c refactor: duplicate check for * 2024-03-20 12:29:58 +05:30
Ankush Menat
5eca52b2c7 fix: only trim tab if it starts with tab 2024-03-20 12:29:58 +05:30
Ankush Menat
ea193ecd48 Revert "Revert "fix: search_link fails when txt contains parentheses (#22892)""
This reverts commit c0cf13b8e8.
2024-03-20 12:29:57 +05:30
Ankush Menat
8a7beebf30
fix: handle distinct for fieldname (#25511)
`distinct count(fieldname)` is supported well but `count(distinct fieldname)` fails if fieldname contains full field with table name included. This PR just adds basic handling for it.

Needs to be rewritten entirely in QB __some day__.
2024-03-18 13:38:29 +00:00
Ankush Menat
adf24b24d4
perf: use base32 space for random names instead of base16 (#25497) 2024-03-17 20:02:57 +05:30
Ankush Menat
ce124d8ec2
fix: Skip virtual doctype rename for dynamic links (#25479) 2024-03-15 14:01:40 +00:00
Ankush Menat
b28db475fd
fix: Skip virtual doctypes while renaming (#25473) 2024-03-15 18:56:22 +05:30
Ankush Menat
f6e58f229c
fix: child table rating fields (#25433) 2024-03-14 09:19:29 +00:00
Ankush Menat
8a3dd85503
Merge pull request #25295 from ankush/virtual-doctype-dx
fix(DX)!: virtual doctype APIs
2024-03-11 18:37:20 +05:30
Ankush Menat
f7c0dd66fd refactor: migrate virtual doctypes to new API 2024-03-11 18:25:05 +05:30
Ankush Menat
b8c4eff68a fix: Skip child table management for children of virt doctypes 2024-03-11 18:15:25 +05:30
Ankush Menat
a28921750d fix(DX): Avoid use of args in virtual doctype 2024-03-11 15:20:35 +05:30
Ankush Menat
68a78d33d3 fix!: Enqueue action after commit 2024-03-11 14:19:59 +05:30
Ankush Menat
495273dcf9 fix: faster change of hash prefix 2024-03-10 21:48:56 +05:30
Ankush Menat
665f1fdf79 perf: optimize hash naming for MySQL storage
Random names can send rows all over the place, typically documents
created closer in time should live closer on mysql pages too.
2024-03-10 21:22:36 +05:30
Ankush Menat
638dbb6bcd fix: disable transaction commits during doc events
- Events like doc.save and doc.submit need to be atomic
- Document hooks can make it not so atomic.

This is extending server script behaviour where server script hooks are
not allowed to commit/rollback.
2024-03-06 14:53:00 +05:30
Suraj Shetty
9a1bd6c1ac
fix: No need to sort keys while saving JSON to DB (#25205)
* fix: No need to sort keys while saving JSON to DB

Also, adding indent is unnecessary.
2024-03-04 05:44:46 +00:00
Ankush Menat
fc5ce044e6 fix: prevent deletion if document is locked 2024-02-29 16:34:39 +05:30
Ankush Menat
8f00aae160 fix: lock the doc before deleting
Locking only prevents this kinda race conditions:
- User A deletes doc
- User B modifies doc so that it's not deletable anymore.
2024-02-29 16:22:02 +05:30
Jannat Patel
898f982a88
fix: replaced created by with owner in base_document (#25059) 2024-02-26 12:12:26 +00:00
Riandrys Gongora Roman
f992821459
fix: translation get label from fieldname 2024-02-22 16:00:59 -05:00
Akhil Narang
3f1e19de85
refactor(treewide): enable RUF rules
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-21 16:20:28 +05:30
Ankush Menat
beb75ef66e
Merge pull request #24919 from scdanieli/fix-has-value-changed
fix: ensure has_value_changed works for Datetime, Date and Time fields
2024-02-19 10:54:45 +05:30
Ankush Menat
0d847439b6 test: add more tests for has_value_changed 2024-02-19 10:42:21 +05:30
scdanieli
a1cb19c820 fix: ensure has_value_changed works for datetime, date and timedelta fields 2024-02-18 16:05:31 +01:00
Raffael Meyer
fc64e8a0fb
feat: pass doctype as context when translating label (#24903) 2024-02-18 19:42:15 +05:30
Ankush Menat
72c2207e0f refactor: useless use of dict in frappe.get_doc 2024-02-10 12:52:38 +05:30
Akhil Narang
26ae0f3460
fix: ruff fixes
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-07 17:04:31 +05:30
Ankush Menat
d89e0e7e4c feat: let users unlock stuck documents 2024-02-06 12:55:31 +05:30
Ankush Menat
d616341ad4 fix: Auto delete very old document locks
locks older than 12 hours are most likely from dead processes. They can be (mostly) safely ignored.
2024-02-06 12:28:05 +05:30
Ankush Menat
1f9efb7b3f fix: better file locking 2024-02-06 11:55:30 +05:30