Commit graph

571 commits

Author SHA1 Message Date
Rutwik Hiwalkar
657faea60d chore: drop dead comment 2024-04-23 21:11:55 +05:30
Rutwik Hiwalkar
fa18de6302 chore: check_if_latest for discard action 2024-04-23 20:35:36 +05:30
Rutwik Hiwalkar
5335d6c19c chore: revert transition rule for 0 to 2
doing explicit transition check for discard because,
* there's only one transition check that is required
* draft(0) > cancelled(2) and submitted(1) > cancelled(2) are valid
  checkes for save so it doesn't make sense editing
  check_docstatus_transition
2024-04-17 20:51:04 +05:30
Rutwik Hiwalkar
82d61b32e4 fix: misc fixes for discard action
* use write perms instead of cancel
* update docstring
* remove discard from global namespace
2024-04-17 12:32:34 +05:30
Rutwik Hiwalkar
b274c45992 feat: discard draft transactions 2024-04-16 19:46:34 +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
Ankush Menat
b493bfe7c2 fix(DX): annotate chainable methods with Self return 2024-04-06 11:04:55 +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
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
b8c4eff68a fix: Skip child table management for children of virt doctypes 2024-03-11 18:15:25 +05:30
Ankush Menat
68a78d33d3 fix!: Enqueue action after commit 2024-03-11 14:19:59 +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
Jannat Patel
898f982a88
fix: replaced created by with owner in base_document (#25059) 2024-02-26 12:12:26 +00:00
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
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
Ankush Menat
de9ac89748 style: re-format with ruff 2024-02-05 18:53:33 +05:30
Raffael Meyer
6c8a08d955
refactor: skip permlevel check if all levels are 0 (#24727)
* refactor: skip permlevel check if all levels are 0

* chore: fix outdated docstring

* chore: equality instead of le
2024-02-05 05:19:09 +00:00
Ankush Menat
914406d31b feat: extend perm debugging to popular controllers
- [x] File
- [x] Communication
2024-01-10 15:16:52 +05:30
Sagar Vora
417fce091a
fix: delete existing children first to avoid UniqueValidationError (#24140) 2024-01-08 22:00:54 +05:30
Corentin Flr
42fbb58626
fix(document): Pass parent_doc and parentfield in _set_defaults 2023-12-23 20:40:52 +01:00
Ankush Menat
4d68a46b10
fix: Set default child table fields on save (#23913)
We set defaults on creation of new doc but when you append a new child
doc on existing document it doesn't seem to set the defaults.

This seems like a bug and not a deliberate choice.
2023-12-22 08:02:36 +00:00
Hussain Nagaria
8d2137c265 docs: consistent doc strings 2023-12-18 18:27:39 +05:30
Shariq Ansari
52cea3e01c chore: better code 2023-12-08 15:49:33 +05:30
Shariq Ansari
78cf0cd142 fix: check if autoname is promt before setting __newname 2023-12-08 10:53:58 +05:30
barredterra
c35476256f refactor: simplify conditional logic
Command: `sourcery review --fix --enable de-morgan .`
2023-12-05 11:14:41 +01:00
Akhil Narang
18867b273f
chore: make return type annotation make more sense
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
gavin
8e7cd47d3d
feat: Document.remove_tag (#22970)
Added remove_tag API for consistency
2023-10-30 16:10:20 +05:30
Maharshi Patel
409a3a8105 Merge branch 'develop' into fix-attach-before-doc-save 2023-10-19 11:40:20 +05:30
Ankush Menat
018ed845bd refactor: defer unnecessary json-dumping of messages
Also avoid accessing locals where interface is present like for popping last message.
2023-10-16 18:13:50 +05:30
Ankush Menat
d5a21a2676 fix: rename type validation
`None` can be passed which is acceptable here.

TODO: Make slackdict accept none as bool and convert to False
2023-10-16 18:12:53 +05:30
Ankush Menat
11dd961d81 refactor!: Method whitelisting
Document.whitelist doesn't work, no idea why it's doing all weird
`__func__` business.

`@frappe.whitelist()` works just fine.
2023-10-16 18:12:53 +05:30
Ankush Menat
52d6bd67e4 fix: Always return document from doc.insert 2023-10-13 15:34:03 +05:30
Akhil Narang
1482ad68c9 fix(model/document): add missing parameters to docstring
[skip ci]

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-10-13 14:51:39 +05:30
Maharshi Patel
53cdd6d1bf fix: relink attachments before saving doc
Certain people add attachment, before filling mandatory fields
which will raise Missing Fields error.

Or any other kind of errors raised by different validators due to which
file is uploaded but doc is not saved.

This will lead to orphaned/mislinked files. ex. new-purchase-receipt-1

This fix changes name of new docs to new-<doctype>-<no>-<10digithash>
after saving the document we can use this new name to find any mislinked
files created in past hour and relink them to the new doc on save.
2023-10-10 23:49:16 +05:30
Akhil Narang
b601131d8f
fix: don't allow setting an invalid rating (#22633)
* feat: don't allow setting an invalid rating

Convert anything <0 to 0, and anything >1 to 1

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* chore: add in tests for rating

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

---------

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-10-10 15:38:58 +05:30
Ankush Menat
6a2bfbf61d
fix: Ignore perm while updating module onboarding (#22448)
* fix: Ignore perm while updating module onboarding

* fix: incorrect error message
2023-09-18 09:00:53 +00:00
Ankush Menat
edfeb0d932 fix(UX): Highlight which permission is missing 2023-08-29 19:11:58 +05:30
Gavin D'souza
6b1609d277
fix: Cast documents iterable to list in db_insert 2023-08-25 16:12:48 +05:30
Gavin D'souza
a996ff7f5b fix: Handle child record insertions via bulk_insert 2023-08-18 14:17:19 +00:00
mergify[bot]
fd10ab25cc
Merge pull request #22003 from gavindsouza/refactor-doc-bits
refactor: Use single query to delete child rows on doc.save
2023-08-11 06:45:07 +00:00
Gavin D'souza
84f134a683
fix: Add "better" typing hints 2023-08-11 11:45:47 +05:30