Commit graph

50 commits

Author SHA1 Message Date
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
Suraj Shetty
c71c132ba2 Workflow actions (#5598)
* Init workflow actions

- WIP code
- Add hooks to create and update
workflow action on document status changes.
- Tweak listview to show host document on list view item click
- Add new doctype "Pending Workflow Action"
- Add allow_self_approval check in Workflow master

* Rename doctypes

- Rename "Workflow Action" to "Workflow Action Master"
- Rename "Pending Workflow Action" to "Workflow Action"
- Remove irrelevant files

* Clear old workflow action on docstatus change

- Add check for user permission before creating a workflow action record
- Make doctype changes to support the Workflow Action  System

* Show host document only if workflow action status is open

* Send workflow action mail notifications

* Add patch to rename `tabWorkflow Action` to `tab Workflow Master`

- Rename table to retain data in `tabWorkflow Action` as it
will be overwritten with new structure on migration

* Enqueue email

* Remove unused files

* Add hook for custom has_permission

* Optimize send_workflow_action_email method

* Add permission_query_condition hook

* Show notification based on status

* Override get_form_link in list view

* Refactor workflow action

- Add action link
- update workflow action hooks

* Avoid repeated creation of Worklow Actions

- Update hooks entry to avoid unwanted method call

* Fix error with frappe.db.count usage

* Fix ui/ux for Workflow Action

- Fix action url and improve response on action button click
- Fix workflow action template style

* Fix Codacy

* Add self approval check

* Fix codacy

* Fix test

* Fix python version confilct and a permission error

* Fix incorrect 'this' reference

* Update with requested changes

* Add next action email template option

* Fix string formatting

* Refactor workflow Action

- Make process_workflow_action smaller

* Fix bugs and errors due to refactor

* Fix workflow field caching

* Add a workflow action test

* Fix bugs with email template
2018-05-30 11:24:49 +05:30
Suraj Shetty
cb627cc7d6 workflow fix (#5452)
* workflow fix

* add a line
2018-04-17 01:23:49 -08:00
Nabin Hait
5c824c1ee0
Revert "[Minor][Bug Fix] permission in workflow docs (#5449)" (#5453)
This reverts commit 4d4c4e55fd.
2018-04-17 12:50:10 +05:30
KanchanChauhan
4d4c4e55fd [Minor][Bug Fix] permission in workflow docs (#5449) 2018-04-17 11:59:38 +05:30
Rushabh Mehta
c4e1b9e0c1
[enhance] Add condition in transitions and move workflow to server-side (#5399)
* [workflow] move to server side

* [workflow] tests

* [workflow] tests

* [minor] remove print

* [fixes] tests and lint

* [tests] fix typo

* [fix] tests
2018-04-11 00:38:13 -08:00
Anand Doshi
2995f02f3b Web Notes to Frappe, better alerts, css fixes, fixed splash 2015-03-03 15:09:34 +05:30
Anand Doshi
3394c82e5f Calendar bug, show workflow buttons only if active workflow exists. Fixes frappe/erpnext#1550 2014-05-02 18:01:38 +05:30
Anand Doshi
edbadc18b2 Changed frappe.conn to frappe.db 2014-02-26 12:35:02 +05:30
Rushabh Mehta
024ddfcc5b -webnotes +frappe 💥 2014-02-14 14:55:11 +05:30