seitime-frappe/frappe/core
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
..
api fix!: Switch to creation as default sort order 2024-03-27 11:18:28 +05:30
doctype fix: meta signature (#28526) 2024-11-20 04:17:38 +00:00
page feat: permission log 2024-09-30 14:54:32 +05:30
report refactor: unit vs integration treewide (#27992) 2024-10-06 09:43:36 +00:00
web_form fix(style): Update icons, new design for /me 2024-09-18 14:27:37 +05:30
workspace fix: build workspace, add webhook log 2024-09-30 20:54:52 +02:00
__init__.py chore: Update header: license.txt => LICENSE 2021-09-03 12:02:59 +05:30
notifications.py docs: consistent doc strings 2023-12-18 18:27:39 +05:30
README.md rename Profile to User frappe/frappe#470 2014-03-11 16:14:47 +05:30
utils.py perf: Document objects without circular references (#17080) 2024-01-17 17:22:55 +05:30

Core module contains the models required for the basic functioning of frappe including DocType, User (user), Role and others.