Commit graph

5931 commits

Author SHA1 Message Date
Hussain Nagaria
673269fdcf fix: typo in test controller boilerplate 2024-12-21 13:13:22 +05:30
ruthra kumar
63a6c8c903 refactor: log in monitor as well 2024-12-20 11:35:41 +05:30
ruthra kumar
29cf8cef8f feat: log peak memory usage for Prepared reports 2024-12-20 10:18:27 +05:30
Ankush Menat
30ec033747
perf: Speedup get_doc by another ~1.5x (#28807)
* perf: Reduce impact of forced cache replacement on every doc access

* fix: clear cache before processing users

Note: This is just an artifact of testing model, this won't have any real
effect on execution in real system.

Basically `enqueue_on_commit` is not respected in tests and it can't be
practically supported either.
2024-12-17 16:48:43 +05:30
Akhil Narang
fae07e4bbb
fix(package): validate package name, export path
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-12-16 17:19:54 +05:30
Ankush Menat
1b1126c1c8
perf: index document name (#28718)
Moved index from doctype to docname. Docname always has higher
cardinality. Even if you filter by both it shouldn't matter as
cross-doctype name conflicts are rather rare.

Perf impact of this change should be net 0 but it does addresses problem
of indeterministic load times based on how many errors exist in db.

closes https://github.com/frappe/frappe/issues/28713
2024-12-09 09:08:59 +00:00
Ankush Menat
60bc472ab6
revert: restore JSON files (#28717)
* Revert: bring back JSON files

* chore: re-apply changes to new files

* chore: remove old TOML files

* chore: delete empty files
2024-12-09 08:41:56 +00:00
Sumit Bhanushali
1bb26f68d3 fix: check at doc level when if owner role permission is checked during export from list view
(cherry picked from commit 1ed45ceb97868c9b517dd3066f0b4ea2cd5358f5)
2024-12-09 07:22:32 +00:00
Sumit Bhanushali
91d553c9cf
Merge pull request #28363 from frappe/expr-series
fix(NamingExpression): series should be separate for different format expressions instead of global
2024-12-09 12:13:28 +05:30
Gavin D'souza
c6580b5880
refactor: Replace pytz to std lib zoneinfo & datetime
Signed-off-by: Gavin D'souza <gavin.dsouza@switchup.de>
2024-12-06 15:43:33 +05:30
Sumit Bhanushali
aaefd066f0 fix: validate "format:" expression to only contain one set of {#} pattern 2024-12-06 13:03:27 +05:30
Raffael Meyer
5c4dc84bad
fix: handle empty images (#28669)
Resolves #28668
2024-12-04 16:16:42 +01:00
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
Sumit Bhanushali
3e74559617
Merge pull request #28622 from Z4nzu/develop
fix: Allow read-only fields to display even without value
2024-12-03 18:37:29 +05:30
Hardik Zinzu
634961d020 feat: Add system setting to control visibility of empty read-only fields 2024-12-03 16:43:49 +05:30
Faris Ansari
f7c005dc09
Merge pull request #28629 from netchampfaris/autoincrement-renaming
fix: allow renaming autoincrement documents
2024-12-02 14:25:05 +05:30
Faris Ansari
188f9f9650 fix: show Allow Rename field always 2024-11-30 16:48:49 +05:30
Faris Ansari
0ef8001102 fix: allow renaming autoincrement documents 2024-11-30 14:58:15 +05:30
David Arnold
e2a8c7fed3
test: fix universal type checker based on downstream use and more testing (#28619)
* test: fix universal type checker based on downstream use and more testing

* fix: type validation error reporting

* fix: types; various

* chore: switch off test-time type checking

still too many errors
2024-11-28 23:35:32 +01:00
Akhil Narang
a350b5c6de
refactor(user_query): adjust query, only check fields if required
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-11-21 18:08:37 +05:30
Akhil Narang
1a8d9d1122
refactor(user_query): simplify with as_list=True
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-11-21 18:05:41 +05:30
Nihantra Patel
b250d19153 fix: user_query 2024-11-21 12:20:18 +05:30
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
Raffael Meyer
64b2010d21
refactor: readability of translation tests (#28519) 2024-11-19 19:05:05 +00:00
Frappe PR Bot
8c8bea7a36
fix: sync translations from crowdin (#28441)
Co-authored-by: barredterra <14891507+barredterra@users.noreply.github.com>
2024-11-19 19:22:20 +01:00
David Arnold
4f6e2fbe93
fix: boilerplate test case (#28514) 2024-11-19 11:29:34 +00:00
Akhil Narang
455edcb7d3
Merge pull request #28478 from akhilnarang/clarify-naming-series-options
chore(document_naming_settings): clarify that FY and ABBR require ERPNext being installed
2024-11-19 15:58:01 +05:30
Akhil Narang
605a11a4a1
Merge pull request #28498 from akhilnarang/fix-user-query
refactor(user_query): switch to `frappe.get_list()`
2024-11-19 15:56:54 +05:30
Shariq Ansari
16b56ee895
Merge pull request #28459 from shariquerik/billing
feat: Billing Page
2024-11-19 11:30:57 +05:30
Akhil Narang
b3acb7857b
refactor(user_query): switch to frappe.get_list()
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-11-18 13:04:15 +05:30
Akhil Narang
c06f528037
chore(document_naming_settings): clarify that FY and ABBR require ERPNext being installed
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-11-15 18:04:49 +05:30
Shariq Ansari
a78bcc4566 fix: allow adding condition (js) in navbar settings dropdown 2024-11-15 14:31:34 +05:30
Sumit Bhanushali
0baf4c85db fix(User): validate user email presence on create email account, hide impersonate user on new doc 2024-11-14 16:53:38 +05:30
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
Akhil Narang
6aeccbb669 chore: format
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
(cherry picked from commit ddc0d6007c2dd93a177717eec4178fb4db4d3620)
2024-11-12 10:01:43 +00:00
gavin
bdaa979159 chore: "or" over "if not" pattern
Co-authored-by: Akhil Narang <me@akhilnarang.dev>
(cherry picked from commit e7e7ee0ec15d73c1e59cc34b93253ad21d619e0a)
2024-11-12 10:01:43 +00:00
Maverjk Carter
ae1c887b58 fix: check app logo from website settings before checking navbar settings
(cherry picked from commit 3db7f7a674930c864fa0aa6ed89cc43d2e32c46f)
2024-11-12 10:01:43 +00:00
Devin Slauenwhite
e8d9bd39c7
feat: get current session user roles if uid is not provided (#26808) 2024-11-06 15:48:59 +05:30
Hussain Nagaria
465793849c fix: store and use default currency from system settings 2024-11-04 16:08:27 +05:30
Hussain Nagaria
ec742dfe02 fix(UI): succinct field name for DocType name 2024-11-04 14:55:53 +05:30
Sumit Bhanushali
0948874c62 fix: dont display phone numbers to which sms was sent to 2024-10-24 21:45:37 +05:30
David Arnold
91a737d8fe
chore(typing): fix some (exotic) type errors treewide (#28210) 2024-10-21 10:02:04 +00:00
David Arnold
8b1180ba27
refactor: server script autocompletion to be more generic (#28180) 2024-10-19 12:56:24 +00:00
Sumit Bhanushali
6eefe3e6b5 fix: forbid setting perm level as negative number 2024-10-15 23:35:29 +05:30
David Arnold
0204db6547
chore: move to use new test record api (#28105) 2024-10-12 23:13:41 +00:00
Sumit Bhanushali
a8c338a299 fix: render of multicheck for success action 2024-10-10 17:29:10 +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
Khaled Bin Amir
afd5d73a5b
doc: Add ABBR variable to help text of doc naming settings (#27809)
* Add ABBR variable in naming settings

* Update document_naming_settings.json
2024-10-10 10:04:40 +00: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