* fix(db_query): Don't track link_tables separately
Treat all joined tables the same, expand the fieldnames whether Table or
Link type with their respective table names
* fix(db_query): Add link join conditions for all relevant fields
* Revert "fix(db_query): Add link join conditions for all relevant fields"
This reverts commit 79622ab4cea5aa73a24f4ba7afde8e83510a79fb.
* Revert "fix(db_query): Don't track link_tables separately"
This reverts commit b8364f781e52e7ffaa7faa8878ef409b023f2288.
* fix: Check link field tables permissions in permlevel checks
* test: Fix, add for test_permlevel_fields
Previous assertion was wrong :')
added extra to check if access is fine
Problem:
document.save() throws "Object is not scriptable exception" when fetching values from virtual doc.
Root cause:
```python
# ....
if frappe.get_meta(doctype).get("is_virtual"):
values = frappe.get_doc(doctype, docname) <--- Document is not scriptable.
.as_dict()
# ....
def set_fetch_from_value(self, doctype, df, values):
fetch_from_fieldname = df.fetch_from.split(".")[-1]
value = values[fetch_from_fieldname] <--- Tries to access value by key and throws "Object is not scriptable" exception
```
Solution:
```python
if frappe.get_meta(doctype).get("is_virtual"):
values = frappe.get_doc(doctype, docname).as_dict() <--- Makes the document scriptable.
```
When migrating base doctypes we need to insert docfield which triggers
document naming rule code and document naming rule doesn't yet exists
cause that's what we are trying to migrate.
Fix: skip naming rule on bootstrapped doctypes.
* fix(db_query): Allow link field to have 'tab'
Issue: Occurence of tab was used to check if the selected field is a table name
and not a fieldname. This caused DocTypes with fields like `tablets` or
`table_name` to break List Views.
Change: Check if the field exists in meta to be sure that the selectable
is a field.
* fix: Split once to ensure at most 2 args
* Util get_permitted_fields checks for valid columns instead of planned logic
* Remove virtual field from dict if not in permitted fields
* Remove reliance on sentinel object _DOC_DELETED_ATTR