* perf: `Document` objects without circular references
Circular references are usuallly considered bad for GC, avoiding them
since they don't seem to be necessary.
* fix: explicitly convert to weakref
* fix: search_link fails when txt contains parentheses
* fix: updating regex to replace number params also
* chore: replacing regex with sqlparse
* chore: not including fields like count(1) in asterisk_fields
* fix: owner/module not identified as column
* chore: lint fix and removing exception
* refactor: better function name
---------
Co-authored-by: Ankush Menat <ankush@frappe.io>
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.
Doing has_permission and then manually raising exception erases the perm check messages.
This causes insane amounts of confusion when perm error says X not
permitted while user is trying to check Y.
We set defaults on creation of new doc but when you append a new child
doc on existing document it doesn't seem to set the defaults.
This seems like a bug and not a deliberate choice.
People ususally write queries like these...
```
frappe.get_all(doctype, {"name": ("in", list_of_docs))
```
Ocassionally, the `list_of_docs` is empty because it's dynamically
generated and in this case we end up doing full table scan to find... nothing!
These are prone to breakage and shouldn't be deleted automatically.
This mostly works fine but there can be cases where it doesn't. So best to leave them untouched.
Related: https://github.com/frappe/frappe/issues/23475
Likely caused by: https://github.com/frappe/frappe/pull/22110
Because run_doc_method passes doc from client to server side, we end up
setting values for what is a "virtual field", this is why it finds some
value and not re-evaluate it.
IMO there are only mild breaking ways of fixing this:
1. Virtual fields should always be computed.
2. Virtual fields should not be set when init-ing the arguement. (e.g. from doc.set APIs )
- Since the field name is specified use it as a non standard field because it is hard to determine which field is standard. It is often wrong to assume the first entry has the statndard field