Commit graph

3712 commits

Author SHA1 Message Date
David Arnold
75377aaaf5
refactor(typing): type filters (#28218)
* chore(typing): type filters

* chore(typing): type filters for get_list et al

* fix: dashboard chart filter expression

* test: fix case with new-style right hand object to equality check

* chore: place new typed filter under typing verification

* chore: remove debug print statment

* chore: inverse logic of type guard

* fix: add float to filter value types

* chore: clarify value naming
2024-12-04 23:18:53 +00:00
Akhil Narang
72d658a256
fix(desktop): manual fixup on top of ruff's changes
This seems like what the original code wanted to do, I think

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-12-04 13:23:52 +05:30
Akhil Narang
84ef6ec677
refactor: fixup with ruff 0.8.1
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-12-04 13:18:04 +05:30
Corentin Forler
e1bfc1bedc
fix(query_report): Check both read and select perms 2024-11-25 12:11:29 +01:00
Raffael Meyer
9208b58b6f
refactor: use doc.check_permission (#28317)
* refactor: use `doc.check_permission`

* refactor(delete_doc): check_permission_and_not_submitted
2024-11-22 10:41:24 +01:00
Corentin Forler
e0c08fab4e
fix: Fix typo in build_domain_restriced function names 2024-11-20 13:52:19 +01:00
David Arnold
3c1392c8fd
fix: meta signature (#28526)
* fix: meta

* fix: test case

save is required:

1. Fetch values
```python
	def get_invalid_links(self, is_submittable=False):
		"""Return list of invalid links and also update fetch values if not set."""
		...
```

2. Is triggered by
```python

	def _validate_links(self):
		if self.flags.ignore_links or self._action == "cancel":
			return
        ...
```

3. Which is triggered by either `_save` or `insert`

----

`reload` does not trigger link fetch
```python
	def reload(self) -> "Self":
		"""Reload document from database"""
		return self.load_from_db()
```

Neither does the new calling path which does not excempt Document
from caching when initializing meta.

It can be proven that this revert would be an alternative fix. But this
seems design by accident and there's no preceivable reason to excempt
Document args from being cached normally.

diff --git a/frappe/model/meta.py b/frappe/model/meta.py
index c4321f0128..87452c812c 100644
--- a/frappe/model/meta.py
+++ b/frappe/model/meta.py
@@ -70,11 +70,10 @@ def get_meta(doctype: str | dict | DocRef, cached=True) -> "_Meta":
 	Returns:
 	    Meta object for the given doctype.
 	"""
-	if cached and (
-		doctype_name := getattr(doctype, "doctype", doctype)
-		if not isinstance(doctype, dict)
-		else doctype.get("doctype")
-	):
+	if cached and not isinstance(doctype, Document):
+		doctype_name = (
+			getattr(doctype, "doctype", doctype) if not isinstance(doctype, dict) else doctype.get("doctype")
+		)
 		if meta := frappe.cache.hget("doctype_meta", doctype_name):
 			return meta

Therefore, we comply the test.
2024-11-20 04:17:38 +00:00
David Arnold
0727c0de0d
feat: allow to store form tours in custom module (#28496) 2024-11-20 00:48:45 +01:00
Corentin Forler
b410d7f5ff
chore: Format 2024-11-14 17:57:50 +01:00
Corentin Forler
8cac65b4e2
fix(query_report): Validate filters using select permission, not read 2024-11-14 17:28:45 +01:00
Corentin Forler
572391afd6
fix(query_report): Fall back to session user before validating permissions 2024-11-14 16:03:23 +01:00
David Arnold
057139ea2e
chore(communication): cleanup unused code (#28199)
* chore: feedback doctype no longer exists

missed from https://github.com/frappe/frappe/pull/17479

* chore: remove unused communication type

This was removed and migrated already in v12:

```
frappe/patches/v12_0/setup_comments_from_communications.py:	frappe.db.delete("Communication", {"communication_type": "Comment"})
```
... comming from 41d90fa6d1
which effectively reverted 465318878e
2024-11-14 00:12:14 +01:00
Hussain Nagaria
465793849c fix: store and use default currency from system settings 2024-11-04 16:08:27 +05:30
Raffael Meyer
09cdf32f00
fix(Workspace): check perms on deletion (#28315) 2024-10-29 00:35:38 +01:00
Akhil Narang
2c3916f898
refactor: change logic slightly, reformat JSON
Invert the check: `disable_edit` -> `allow_edit`

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-10-22 15:17:13 +05:30
root
65db85d559
fix: changed enable edit select option to disable edit checkbox 2024-10-22 15:17:13 +05:30
root
0b9df2b994
feat: enable or disable bulk edit from list view settings doctype 2024-10-22 15:17:13 +05:30
David Arnold
0204db6547
chore: move to use new test record api (#28105) 2024-10-12 23:13:41 +00:00
Akhil Narang
fe3e22efc9
Merge pull request #28073 from akhilnarang/guess-fieldtype-total-row
chore(add_total_row): guess fieldtype from cell data type if not defined
2024-10-11 11:35:04 +05:30
Akhil Narang
dea09e5384
chore(add_total_row): guess fieldtype from cell data type if not defined
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-10-10 17:13:02 +05:30
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
83bc1f09e9
refactor: clarify test record dep management in test modules (#28060) 2024-10-09 13:44:27 +00:00
David Arnold
95950c8d81
refactor: organize test contextmanagers (#28041)
* refactor: prefer staticmethod decorator

* refactor: add cm register utility and keep cms in one file

* refactor: enter safe_exec enabled context (treewide)

* refactor: move trace fields to the other test context managers

* chore: marke all test_runner functions for deprecation

* chore: mark some tests.utils functions for deprecation (moved)

* chore: mark traced_field_conext for deprecation (moved)

* chore: placate semgrep in dumpster

* fix: show deprecation warnings per module in tests (incl. from dumpster)

* chore: remove use of deprecated functions from tests
2024-10-09 02:09:19 +02:00
David Arnold
8cfeb156df
devx: add deprecation dumpster (#27887)
* feat: Add deprecation_dumpster.py file

* docs: add jovial and jocose docstring for frappe/deprecation_dumpster.py

* refactor: fill the dumpster with its own kind

* refactor: move to the deprecation dumpster

* chore: color coding class

* fix: only check import error when import errors
2024-10-08 18:56:10 +02:00
David Arnold
e7776021aa
refactor: Structure frappe.test.utils (green to green) (#28038)
* docs: constitute frappe.test readme

* refactor: move utils to __init__

* refactor: move generators into generators.py

* refactor: move cm into context_managers.py

* refactor: move test classes into submodule

* refactor: reexport general purpose context managers

* refactor: adapt imports (treewide)
2024-10-08 15:10:24 +00:00
Akhil Narang
9b5af4a603
fix: set print_logs=False for some has_permission() calls
This otherwise results in a lot of spam like: https://github.com/frappe/frappe/pull/27931#issuecomment-2396505626

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-10-07 16:00:39 +05:30
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
Jitendra Mishra
ca93818c76
chore: Avoid to re-check instance of filters (#27959) 2024-10-02 16:10:04 +05:30
Sumit Bhanushali
99b8899ff6 feat(PrivateApp): virtual app that will host all private workspaces of user 2024-10-01 14:03:11 +05:30
Akhil Narang
789f0a58c7
Merge pull request #27771 from jabir-elat/develop
Fix: Enforced user permissions on report filters for linked doctypes
2024-10-01 12:50:10 +05:30
David Arnold
92ee2ce291
Merge pull request #27931 from blaggacao/feat/sidebad-with-log-links
Feat: sidebar with log links
2024-09-30 13:41:25 +02:00
David
22498f26a7
feat: add link to (various) logs in sidebar 2024-09-30 13:24:55 +02:00
Sumit Bhanushali
08aa9158dd
Merge pull request #27908 from frappe/ws_types
feat(Workspace): user can now add doctype, page, report, external url as workspace and get easy access on sidebar
2024-09-30 11:09:00 +05:30
David
74e5c61ec4
feat: set flag during bulk delete c/o doc on_trash event 2024-09-30 06:52:44 +02:00
Akhil Narang
0c6d5de805 fix(query_report): use the correct key
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-09-27 19:24:43 +05:30
Akhil Narang
90bd55690a refactor(query_report): simplify logic
Reduce one level of nesting

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-09-27 19:24:43 +05:30
Akhil Narang
b17238f997 fix(query_report): fix indentation, add some newlines
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-09-27 19:24:43 +05:30
jabir-elat
b754bdb03d refactor(query_report): filter check 2024-09-27 19:24:28 +05:30
jabir-elat
e4485bebb0 fix(query_report): enforced user permissions on report filters for linked doctypes 2024-09-27 19:18:51 +05:30
Sumit Bhanushali
950814747c feat(Workspace): user can now add doctype, page, report, external url as workspace and get easy access on sidebar 2024-09-26 16:58:52 +05:30
Rushabh Mehta
34a0faa073 fix(patch): update_app.py 2024-09-23 22:54:35 +05:30
Rushabh Mehta
e01bdd9283 fix(minor): set defaiult workspace app in desktop.py 2024-09-23 22:18:59 +05:30
Rushabh Mehta
5099041947 fix(minor): workspace/patches/update_app.py 2024-09-23 21:12:02 +05:30
Rushabh Mehta
f24f327596 fix(minor): workspace/patches/update_app.py 2024-09-23 20:52:29 +05:30
Rushabh Mehta
dc21fbcb56 fix(minor): set default app as frappe in workspace if no app or module defined 2024-09-23 20:50:43 +05:30
Rushabh Mehta
7acf1fd346 fix(minor): set default app in module and workspace 2024-09-23 20:43:12 +05:30
Rushabh Mehta
5437e895de fix(minor): set default app in module and workspace 2024-09-23 20:42:38 +05:30
Rushabh Mehta
72f236aa9f
Merge pull request #27819 from rmehta/fix-icons
fix(style): Update icons, new design for /me
2024-09-23 17:24:55 +05:30
Rushabh Mehta
70c98abc84 fix(minor): only select public workspaces by default 2024-09-23 16:53:31 +05:30
Rushabh Mehta
4da1f70eaf fix(desktop): fixes to app switcher inside desk 2024-09-23 15:19:09 +05:30