-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Discard transactions #25971
Merged
Merged
feat: Discard transactions #25971
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
added
the
add-test-cases
Add test case to validate fix or enhancement
label
Apr 16, 2024
rutwikhdev
added
docs-pending
Feature was merged without docs for some reason
and removed
add-test-cases
Add test case to validate fix or enhancement
labels
Apr 16, 2024
ankush
reviewed
Apr 17, 2024
ankush
reviewed
Apr 17, 2024
ankush
reviewed
Apr 17, 2024
ankush
reviewed
Apr 17, 2024
ankush
requested changes
Apr 17, 2024
TODO:
|
* use write perms instead of cancel * update docstring * remove discard from global namespace
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
ankush
reviewed
Apr 17, 2024
frappe.model.has_workflow
rutwikhdev
added
backport version-15-hotfix
Backport the PR to v15
and removed
docs-pending
Feature was merged without docs for some reason
labels
Apr 18, 2024
ankush
added
defer backport
Backports for some PR are deferred for a week or two to test them properly before releasing
and removed
backport version-15-hotfix
Backport the PR to v15
labels
Apr 22, 2024
Suggestion: maybe both the Discard and Delete menu items could be merged, with a popup to choose between the two. The advantage is that you have the space to explain the difference between discarding and deleting a draft document. |
@cogk they seem like 2 very different actions 🤔 |
Also in some cases we just hide delete based on perms or local requirements. |
ankush
reviewed
Apr 23, 2024
This was referenced Apr 23, 2024
ankush
added
do not backport
and removed
defer backport
Backports for some PR are deferred for a week or two to test them properly before releasing
labels
Apr 23, 2024
rutwikhdev
force-pushed
the
discard-transactions
branch
from
April 23, 2024 15:42
5ae7cca
to
657faea
Compare
ankush
approved these changes
Apr 29, 2024
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #21515
Added discard action under menu items on draft transactions. This action will do transition validation, check write perms, run hooks and do db_set with docstatus 2.
Added Events
Override doc methods: before_discard, on_discard
Client Script: before_discard, after_discard (following same naming conventions as cancel)
Server Script Doctype Events: Before Discard, After Discard
Right now it just validates write perms, perhaps we can add separate permissions later.
docs: https://frappeframework.com/docs/user/en/api/form#form-events