Skip to content

Commit

Permalink
fix: never show virtual fields in list view (backport #24666) (#24668)
Browse files Browse the repository at this point in the history
* fix: never show virtual fields in list view (#24666)

* fix: never render virtual fields in list view

* fix: Hide "in list view" for virtual columns

(cherry picked from commit 4553de8)

# Conflicts:
#	frappe/core/doctype/docfield/docfield.json

* chore: conflicts

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
  • Loading branch information
mergify[bot] and ankush committed Feb 1, 2024
1 parent 4bbfaa7 commit 45e2683
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion frappe/core/doctype/docfield/docfield.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
},
{
"default": "0",
"depends_on": "eval:!doc.is_virtual",
"fieldname": "in_list_view",
"fieldtype": "Check",
"label": "In List View",
Expand Down Expand Up @@ -566,7 +567,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-10-25 06:53:45.194081",
"modified": "2024-02-01 15:55:44.007917",
"modified_by": "Administrator",
"module": "Core",
"name": "DocField",
Expand Down
1 change: 1 addition & 0 deletions frappe/core/doctype/docfield/docfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class DocField(Document):
unique: DF.Check
width: DF.Data | None
# end: auto-generated types

def get_link_doctype(self):
"""Returns the Link doctype for the docfield (if applicable)
if fieldtype is Link: Returns "options"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
},
{
"default": "0",
"depends_on": "eval:!doc.is_virtual",
"fieldname": "in_list_view",
"fieldtype": "Check",
"label": "In List View"
Expand Down Expand Up @@ -477,7 +478,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-12-08 15:52:37.525003",
"modified": "2024-02-01 15:56:39.171633",
"modified_by": "Administrator",
"module": "Custom",
"name": "Customize Form Field",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,5 @@ class CustomizeFormField(Document):
unique: DF.Check
width: DF.Data | None
# end: auto-generated types

pass
4 changes: 3 additions & 1 deletion frappe/public/js/frappe/list/base_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ frappe.views.BaseList = class BaseList {
frappe.meta.has_field(doctype, fieldname) ||
fieldname === "_seen";

if (!is_valid_field) {
let is_virtual = this.meta.fields.find((df) => df.fieldname == fieldname)?.is_virtual;

if (!is_valid_field || is_virtual) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion frappe/public/js/frappe/list/list_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
if (frappe.has_indicator(this.doctype) && df.fieldname === "status") {
return false;
}
if (!df.in_list_view) {
if (!df.in_list_view || df.is_virtual) {
return false;
}
return df.fieldname !== this.meta.title_field;
Expand Down

0 comments on commit 45e2683

Please sign in to comment.