Commit graph

5921 commits

Author SHA1 Message Date
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
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
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
Sumit Bhanushali
a7507c66f2
Merge pull request #27942 from zaqoutabed/develop
feat: allow user to set attachment field public by default
2024-10-08 13:23:29 +05:30
Sumit Bhanushali
750a373388
fix: update docfield public attachment field label to convey that default behaviour
Co-authored-by: David Arnold <dgx.arnold@gmail.com>
2024-10-08 13:09:11 +05:30
Akhil Narang
d453db40ba
Merge pull request #27909 from akhilnarang/number-format-currency-option
chore: add in system setting to allow using number format from currency
2024-10-08 13:03:08 +05:30
DHia' SHalabi
8d83b966a0
refactor: optimize custom button logic for navigation (#27997) 2024-10-06 22:43:59 +02:00
David Arnold
c2c9d9062a
Testing Improvements 3 (#27995)
* feat: set doctype on test classes

* refactor: Transform `make_test_records` into a generator

* feat: lazy create doctype records on first use

* perf: improve file walker

* fix: submission queue test

* refactor: improve logging a bit

* fix: global records install for app (semifix)
2024-10-06 15:04:47 +00: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
David Arnold
b7c8d7368c
Merge pull request #27936 from blaggacao/fix/build-workspace-wehbook-log
fix: build workspace, add webhook log
2024-10-02 00:14:00 +02:00
Abdallah A. Zaqout
c681c79905
add type for make_attachment_public 2024-10-01 09:26:07 +03:00