fix(quick_list): Ensure fields exist before fetching

This commit is contained in:
Corentin Forler 2024-11-23 00:26:35 +01:00 committed by GitHub
parent e964c11cd6
commit ecf2976681
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -205,8 +205,13 @@ export default class QuickListWidget extends Widget {
let add_fields = frappe.listview_settings?.[this.document_type]?.add_fields;
if (Array.isArray(add_fields)) {
fields.push(...add_fields);
fields = [...new Set(fields)];
for (const fieldname of add_fields) {
// Only keep fields that exist and are permitted
if (frappe.meta.has_field(this.document_type, fieldname)) {
fields.push(fieldname);
}
}
fields = [...new Set(fields)]; // Remove duplicates
}
let quick_list_filter = frappe.utils.process_filter_expression(this.quick_list_filter);