fix(db_query): Allow link field to have 'tab' (#19820)
* 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
This commit is contained in:
parent
b3b846472e
commit
7f34d510f2
1 changed files with 6 additions and 3 deletions
|
|
@ -317,13 +317,16 @@ class DatabaseQuery:
|
|||
|
||||
# convert child_table.fieldname to `tabChild DocType`.`fieldname`
|
||||
for field in self.fields:
|
||||
if "." in field and "tab" not in field:
|
||||
if "." in field:
|
||||
original_field = field
|
||||
alias = None
|
||||
if " as " in field:
|
||||
field, alias = field.split(" as ")
|
||||
linked_fieldname, fieldname = field.split(".")
|
||||
field, alias = field.split(" as ", 1)
|
||||
linked_fieldname, fieldname = field.split(".", 1)
|
||||
linked_field = frappe.get_meta(self.doctype).get_field(linked_fieldname)
|
||||
# this is not a link field
|
||||
if not linked_field:
|
||||
continue
|
||||
linked_doctype = linked_field.options
|
||||
if linked_field.fieldtype == "Link":
|
||||
self.append_link_table(linked_doctype, linked_fieldname)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue