fix: correct SQL string formatting in get_sql_string method (#34418)
This commit is contained in:
parent
727775f820
commit
2232ff75c2
1 changed files with 3 additions and 3 deletions
|
|
@ -196,12 +196,12 @@ frappe.ui.SortSelector = class SortSelector {
|
|||
}
|
||||
}
|
||||
get_sql_string() {
|
||||
// build string like: `tabSales Invoice`.subject, `tabSales Invoice`.name desc
|
||||
// build string like: `tabSales Invoice`.`subject`, `tabSales Invoice`.`name` desc
|
||||
const table_name = "`tab" + this.doctype + "`";
|
||||
const sort_by = `${table_name}.${this.sort_by}`;
|
||||
const sort_by = `${table_name}.\`${this.sort_by}\``;
|
||||
if (!["name", "creation", "modified"].includes(this.sort_by)) {
|
||||
// add name column for deterministic ordering
|
||||
return `${sort_by} ${this.sort_order}, ${table_name}.name ${this.sort_order}`;
|
||||
return `${sort_by} ${this.sort_order}, ${table_name}.\`name\` ${this.sort_order}`;
|
||||
} else {
|
||||
return `${sort_by} ${this.sort_order}`;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue