Skip to content

Commit

Permalink
fix: never show virtual fields in list view (backport #24666) (#26578)
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
#	frappe/core/doctype/docfield/docfield.py
#	frappe/custom/doctype/customize_form_field/customize_form_field.json
#	frappe/custom/doctype/customize_form_field/customize_form_field.py

* chore: conflicts

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
  • Loading branch information
mergify[bot] and ankush committed May 28, 2024
1 parent 56b1a46 commit 58db67d
Show file tree
Hide file tree
Showing 4 changed files with 8 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 @@ -565,7 +566,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-10-25 06:53:45.194081",
"modified": "2024-05-28 15:55:44.007917",
"modified_by": "Administrator",
"module": "Core",
"name": "DocField",
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-10-25 06:55:50.718441",
"modified": "2024-05-28 15:56:39.171633",
"modified_by": "Administrator",
"module": "Custom",
"name": "Customize Form Field",
Expand Down
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 @@ -380,7 +380,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 58db67d

Please sign in to comment.