Commit graph

59 commits

Author SHA1 Message Date
Sumit Bhanushali
e967b37c78 fix: workflow should also support queue_in_background
(cherry picked from commit 3d51e725c6bd89af4cd215a858ab25725b24c847)
2024-12-03 07:02:27 +00: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
de9ac89748 style: re-format with ruff 2024-02-05 18:53:33 +05:30
Ankush Menat
9b8a8c155d
fix: Correct logic for can_cancel (#24196)
You can cancel a document IFF:
- Document has no workflow
- Document has workflow but it doesn't have state with docstatus=2.

closes https://github.com/frappe/frappe/issues/19075
2024-01-08 19:15:19 +05:30
Ankush Menat
6cf168a56f fix: bulk workflow action in background 2023-11-24 17:04:09 +05:30
Ankush Menat
892c5e30a2 refactor: Simpler workflow caching
Entire document is cached, so no need to create another layer of cache.
2023-07-19 16:45:44 +05:30
Ankush Menat
774a75dbde
perf: use cached workflow doc for transitions (#21300)
* fix: expire `RECORDER_INTERCEPT_FLAG` in one hour

Leaving this running in prod can be dangerous.

* perf: Use cached doc in workflows
2023-06-09 12:43:40 +05:30
Ankush Menat
fa6dc03cc8
refactor: frappe.cache() usage to frappe.cache (#21282) 2023-06-08 11:47:17 +05:30
PeterG
a182414610
fix(workflow): populate doc from db in apply_workflow (#21068) 2023-05-24 11:35:37 +05:30
gavin
a093b7b34c
perf(workflow): get_transitions (#18834)
* Load from db only if doc passed is not of type Document. This was
  added earlier to load in case of dicts. ref: https://github.com/frappe/frappe/pull/11883
* Move blocks to evaluate only if required
* Add typing hints
2022-11-10 16:22:28 +05:30
Ankush Menat
81b37cb7d2
refactor: clean up code to py310 supported features (#17367)
refactor: clean up code to py39+ supported syntax

- f-strings instead of format
- latest typing support instead of pre 3.9 TitleCase
- remove UTF-8 declarations.
- many more changes

Powered by https://github.com/asottile/pyupgrade/ + manual cleanups
2022-07-01 11:51:05 +05:30
Rushabh Mehta
6e6fe9521e fix(linting): no single quotes :'| 2022-04-18 17:29:03 +05:30
Rushabh Mehta
57a55e4225 feat(minor): Add document reference to Error Log and doc.log_error 2022-04-18 17:29:03 +05:30
Suraj Shetty
c0c5b2ebdd
style: format all python files using black (#16453)
Co-authored-by: Frappe Bot <developers@frappe.io>
2022-04-12 10:59:25 +05:30
Raffael Meyer
89922bae90
feat: utility methods for docstatus (#15515)
* feat: utility methods for docstatus

* refactor: use utility method for doctsatus

* refactor: enum for docstatus

* refactor: docstatus as property

* fix: set docstatus

* feat: docstatus extends int class

* test: docstatus of BaseDocument

* refactor: occurrences of docstatus

* fix: typo

* refactor: move docstatus to a separate file

* test: docstatus

* fix: sider
2022-02-04 07:41:25 +00:00
Gavin D'souza
3446026555 chore: Update header: license.txt => LICENSE
The license.txt file has been replaced with LICENSE for quite a while
now. INAL but it didn't seem accurate to say "hey, checkout license.txt
although there's no such file". Apart from this, there were
inconsistencies in the headers altogether...this change brings
consistency.
2021-09-03 12:02:59 +05:30
Gavin D'souza
e407b78506 chore: Drop dead and deprecated code
* Remove six for PY2 compatability since our dependencies are not, PY2
  is legacy.
* Removed usages of utils from future/past libraries since they are
  deprecated. This includes 'from __future__ ...' and 'from past...'
  statements.
* Removed compatibility imports for PY2, switched from six imports to
  standard library imports.
* Removed utils code blocks that handle operations depending on PY2/3
  versions.
* Removed 'from __future__ ...' lines from templates/code generators
* Used PY3 syntaxes in place of PY2 compatible blocks. eg: metaclass
2021-05-26 15:31:29 +05:30
prssanna
c982875b6a fix: Show cancel button only if document is cancellable 2020-12-28 13:40:12 +05:30
Gavin D'souza
ed01c67f54 style: Black over updated diffs 2020-12-16 15:19:41 +05:30
conncampbell
7a773d2461 feat: Workflow transition condition allows datetime functions 2020-12-14 20:07:39 -07:00
Shivam Mishra
476f21eb4d fix: load doc from db in get_transitions 2020-11-05 18:40:58 +05:30
Rushabh Mehta
72e266f908 fix(tests): cleanup workflow test and commits 2020-08-17 09:41:54 +05:30
Suraj Shetty
d3e4a97b6f
test: Make email account is email account test (#11139) 2020-07-29 17:17:53 +05:30
prssanna
c329a2c1af fix: add update_after_submit to actions while setting worflow state 2020-05-25 12:22:19 +05:30
mergify[bot]
7a35f70d89
Merge pull request #9833 from marination/change-workflow-status-title
fix: Changed 'Errored' to 'Failed' Transactions in Bulk Workflow Status prompt
2020-04-02 11:56:13 +00:00
marination
ea52e51766 fix: Change 'Errored' to 'Failed' Transactions in Bulk Workflow Status prompt 2020-04-01 11:55:42 +05:30
Suraj Shetty
3b93b2a456 refactor: Commonify transition condition evaluation
- This add safe_globals for transition evaluation in workflow_action
2020-03-24 13:28:30 +05:30
prssanna
c0f87b8ab5 fix: make bulk workflow status dialog minimizable 2020-03-16 16:00:38 +05:30
marination
9aa2723ce7 fix: Handling of Manual Exception raises in Bulk Workflow Log. 2020-02-20 15:01:04 +05:30
mergify[bot]
98ef4c1aa5
Merge pull request #9441 from marination/bulk-workflow-apply
fix: Bulk Workflow Action rollback on Error
2020-02-20 05:41:43 +00:00
marination
f5004865b9 fix: Conditional indicator and made strings translatable 2020-02-19 15:46:40 +05:30
marination
f2459e47b7 fix: Added consolidated feedback message
- Message dialog with errored and succesful documents.
2020-02-11 11:51:49 +05:30
marination
d290c645ef fix: Commit succesfull transactions and rollback the rest 2020-02-10 12:55:39 +05:30
marination
3e0b0fb561 fix: Bulk Workflow Action rollback on Error 2020-02-07 18:41:18 +05:30
mergify[bot]
62ea837d07
Merge pull request #9363 from prssanna/workflow-fix
fix(Workflow): Set workflow state when some action is performed on a …
2020-02-05 10:04:49 +00:00
prssanna
44cbdb0ebd fix: iff workflow state of doc is already correct, don't set workflow state 2020-02-05 11:57:23 +05:30
Suraj Shetty
dee4a7336c fix(translations): Incorrect syntax 2020-01-29 15:22:35 +05:30
prssanna
9202997cb8 fix(Workflow): Set workflow state when some action is performed on a document from the backend if workflow exists 2020-01-27 12:09:07 +05:30
Prssanna Desai
8425110af5 fix: hide Cancel button if workflow state and action for Cancel… (#9151) 2019-12-29 18:12:45 +05:30
Suraj Shetty
67b41deb44 test: Add test case to check get_common_transition_actions 2019-06-02 10:56:20 +05:30
Suraj Shetty
12f06d6af7 fix: Change progress title 2019-05-30 17:29:35 +05:30
Suraj Shetty
1d99c1cc86 fix: Pass complete doc to avoid data loss 2019-05-28 17:00:45 +05:30
Suraj Shetty
cc7ea9fae6 fix: Handle edge cases
Handle edge cases like
- same action is used twice for transision
- workflow field is not set for the doc
2019-05-28 14:48:57 +05:30
Suraj Shetty
b4dfd88f5f fix: Make it work in harmony ☮️ 2019-05-28 12:06:22 +05:30
Suraj Shetty
a1e19ba0a3 feat(list view): Add bulk workflow approval option 2019-05-28 08:37:11 +05:30
Faris Ansari
e9b0c2229d fix: Error message for invalid Workflow Transition (#7553)
When you import a document of a DocType which has a workflow, you
shouldn't be able to set the workflow_state to a state except the first.
This patch shows a better error message.
2019-05-25 11:56:20 +05:30
Suraj Shetty
26c6e2928c Move allow self approval check to transisition for more control (#5691)
* Move allow self approval check to transisition for more control

* Disable email alert from workflow test

* Add allow_self_approval to each transition of test workflow

* Remove print statement

* Remove extra blank lines
2018-06-21 09:08:27 +05:30
Suraj Shetty
9e402ec3b5 Clear cache on workflow update (#5677) 2018-06-12 21:50:36 +05:30
Suraj Shetty
6b77c10cc9 [Workflow] Added a check to enable/disable workflow action emails and test fix (#5668)
* Fix build and make py3 compatible

* Remove unused test since state edit check was removed

* Add toggle to enable or disable workflow action emails
2018-06-11 15:09:42 +05:30
Suraj Shetty
944626ed5e [Minor][Fix] Workflow action (#5665)
* Fix incorrect this reference

* Fix verify request for python 3

* Fix workflow validation
2018-06-08 16:33:39 +05:30