Commit graph

240 commits

Author SHA1 Message Date
Sagar Vora
b3e1eda4c8
feat: global frappe.in_test flag (#32960)
* feat: global `frappe.in_test` flag

* feat: helper utility to toggle `frappe.in_test`

* fix: use `toggle_test_mode` util

* fix: use `frappe.in_test`

* chore: add comment explaining global `in_test`

* chore: ignore commit replacing flag usage

* test: temporarily disable `frappe.in_test`

this worked earlier because flag was set in werkzeug.local which was separate for API test client

* test: add comment explaining change
2025-06-17 19:19:31 +05:30
Ankush Menat
8088bd3891
chore: Drop empty UnitTestCases (#32867)
Next to zero adoption after introduction, just noise in codebase.

I don't see any point in arguing about purity of test cases when
existence and quality of test cases is usually the bigger problem.

Dropped using semgrep
2025-06-10 05:28:53 +00:00
rehansari26
70a3eb986c fix: remove unnecessary clear_cache call 2025-04-29 11:49:50 +05:30
rehansari26
bd055ab78c fix: create custom field when doctype is changed 2025-04-28 16:41:53 +05:30
rehansari26
ca812bb307 fix: ensure workflow state field is created post-validation 2025-04-25 17:51:48 +05:30
sokumon
0a4293c49f fix: add control on workflow state to alllow sending emails 2025-04-02 01:03:33 +05:30
sokumon
1320c97a4b fix: set default to not send email to self 2025-03-24 12:11:18 +05:30
sokumon
216223abc8 fix: typo 2025-03-24 02:57:53 +05:30
sokumon
0bc2e197b2 fix: configure if email is sent to creator 2025-03-24 02:29:27 +05:30
Corentin Forler
f72dc93446
fix(workflow_action): Pass context as dict to render template 2025-02-21 14:47:28 +01:00
Sumit Bhanushali
b335abb6aa fix: use get_email_template to support html template in workflow email 2024-10-24 14:43:39 +05:30
David Arnold
0204db6547
chore: move to use new test record api (#28105) 2024-10-12 23:13:41 +00:00
David Arnold
443c38daa9
refactor: toml test records for readability (#28065)
* refactor: toml test records for readability

* fix: maintain backwards compatibility

* refactor: transform in-tree records

* chore: don't use deprecated functions (treewide)

* chore: revert migration of tests which depend on old test records list

* feat: add cls.globalTestRecords on IntegrationTestCase
2024-10-10 13:24:02 +02:00
David Arnold
c114e5fae8
refactor: unit vs integration treewide (#27992)
* refactor: constitute unit test case

* fix: docs and type hints

* refactor: mark presumed integration test cases explicitly

At time of writing, we now have at least two base test classes:

- frappe.tests.UnitTestCase
- frappe.tests.IntegrationTestCase

They load in their perspective priority queue during execution.

Probably more to come for more efficient queing and scheduling.

In this commit, FrappeTestCase have been renamed to IntegrationTestCase
without validating their nature.

* feat: Move test-related functions from test_runner.py to tests/utils.py

* refactor: add bare UnitTestCase to all doctype tests

This should teach LLMs in their next pass that the distinction matters
and that this is widely used framework practice
2024-10-06 09:43:36 +00:00
Akhil Narang
346082643b
chore: format
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-09-13 18:23:00 +05:30
Lyes7
9b89eba337 fix: workflow typos 2024-09-12 10:18:49 +01:00
Ankush Menat
e5271bc034
fix: use document language for workflow action (#26138) 2024-04-24 13:46:25 +05:30
Ankush Menat
3896296c6f fix: update sort order in doctypes 2024-03-27 11:18:28 +05:30
Ankush Menat
b1a8bc9312
fix: Export None as type if select as no options (#25211)
Select options can be dynamic, in that case we should at least the
default value `None` as a value `DF.Literal` otherwise is invalid type
annotation.
2024-03-04 06:42:41 +00:00
Ankush Menat
64a5ebb112
refactor!: Drop user based workflow action compatibility (#24956)
* test: run workflow actions in tests

* test: fix workflow action tests

* refactor!: Remove compatibility with `user` based workflow action

* test: cleanup test cleanups

* fix: restore form dict after printing

* test: patch printing during workflow tests
2024-02-20 14:37:13 +00:00
Nihantra C. Patel
15eb1bf839
fix: send_workflow_action_email (#24929)
* fix: send_workflow_action_email

* fix: send_workflow_action_email
2024-02-19 06:37:20 +00:00
Ankush Menat
8c5aaeb437 test: avoid fiddling with workflow action columns 2024-02-12 12:38:05 +05:30
Ankush Menat
140a01e2cf perf: cache permission results
For each transition, we end up redoing perm check. Nothing has really changed there though.
2024-02-12 11:32:38 +05:30
Ankush Menat
b0a4425230 perf: process workflow email receipients from background 2024-02-12 11:20:17 +05:30
Ankush Menat
8344bce09a refactor: remove needless coupling of return values 2024-02-12 11:14:57 +05:30
Ankush Menat
16fa5ec9bd fix: enqueue_after_commit instead of instantly 2024-02-12 10:51:11 +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
de9ac89748 style: re-format with ruff 2024-02-05 18:53:33 +05:30
Ankush Menat
447f02e8d3
fix!: Remove misleading "raise_exception" (#24266)
frappe.permission.has_permission won't accept raise_exception anymore,
it was extremely misleading argument and actual purpose of the argument
was to print perm check logs.
2024-01-11 08:24:18 +00:00
Ankush Menat
02031fc6f4
fix: don't update docstatus (#24216)
This doesn't make sense.

Updating docstatus without resaving document is a bad idea.

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
2024-01-09 09:32:03 +00:00
Hussain Nagaria
8d2137c265 docs: consistent doc strings 2023-12-18 18:27:39 +05:30
Corentin Flr
4f809630c5
fix: Set sort_order to DESC if sort_field is modified (#23697)
Global search and replace operation, including single doctypes where it does not really matter.
2023-12-13 09:52:14 +05:30
Ankush Menat
21261e63e6
fix: Workflow doc states not existing on new forms (#23756)
[skip ci]
2023-12-12 21:43:19 +05:30
barredterra
c35476256f refactor: simplify conditional logic
Command: `sourcery review --fix --enable de-morgan .`
2023-12-05 11:14:41 +01:00
Corentin Flr
82623e5977
chore(translations): Remove extra space at end of line
When editing translation CSV manually in a text editor, one does not always disable the "trim trailing whitespace" feature. This can lead to mis-translations and duplications (when using `bench get-untranslated`).
2023-11-27 12:17:27 +01:00
Akhil Narang
fbc88a4d24
refactor(treewide): code cleanup
Drop redundant bool conversion

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-23 13:57:51 +05:30
Shariq Ansari
be4e0bbc8a
Merge pull request #23207 from rtdany10/workflow-status
feat: workflow state wise status override
2023-11-20 21:06:59 +05:30
Shariq Ansari
da5b723939
Merge pull request #23217 from rtdany10/workflow-docstatus-validation
fix(workflow): avoid implicit docstatus altering
2023-11-19 10:55:51 +05:30
Dany Robert
ee4f74913c fix: test docstatus change from workflow 2023-11-19 03:02:30 +00:00
Shariq Ansari
d9691c579e
Merge branch 'develop' into workflow-status 2023-11-18 21:39:58 +05:30
Dany Robert
b4c0b10bff fix(workflow): avoid implicit docstatus altering 2023-11-17 14:01:54 +00:00
Shariq Ansari
45aba69a06 fix: set default state as 0 2023-11-16 12:39:31 +05:30
Dany Robert
3f70cebf65 feat: workflow state wise status override 2023-11-13 13:00:14 +00:00
Shariq Ansari
ff5c6e3394 chore: updated workflow builder banner 2023-10-19 11:34:47 +05:30
Sambasiva Suda
53c795f4b8
fix: Workflow Builder not updating diagram with added states/transitions in table (#22429)
Co-authored-by: Shariq Ansari <sharique.rik@gmail.com>
2023-10-03 17:13:51 +05:30
Ankush Menat
dc8d7b019a refactor!: Lower roles from All To Desk User 2023-08-29 12:07:57 +05:30
Ankush Menat
2e9f779a98 fix: check workflow state field to avoid error 2023-08-28 11:02:53 +05:30
Ankush Menat
89c0c1b07b fix: don't enqueue sendmail jobs
- sendmail just creates email queue, it should be done on the fly.
- if OutgoingEmailError occurs then skip all future ones.
2023-08-22 15:25:32 +05:30
gavin
453690ecc0
fix(types): Exporter unconditionally marks fields as Nullable (#21997)
* fix(types): Exporter unconditionally marks fields as Nullable

* fix: correct fieldtype names

* fix: table multi-select type annotations

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2023-08-10 10:18:10 +05:30