fix: query order by
This commit is contained in:
parent
27c23dccac
commit
4eb6cdb157
1 changed files with 3 additions and 5 deletions
|
|
@ -317,14 +317,12 @@ class DatabaseQuery(object):
|
|||
) and not self.group_by)
|
||||
|
||||
if not group_function_without_group_by:
|
||||
if args.get("sort_field") and args.get("sort_order"):
|
||||
args.order_by = "`tab{0}`.`{1}` {2}".format(self.doctype,
|
||||
meta.sort_field or "modified", meta.sort_order or "desc")
|
||||
args.order_by = "`tab{0}`.`{1}` {2}".format(self.doctype,
|
||||
meta.get("sort_field") or "modified", meta.get("sort_order") or "desc")
|
||||
|
||||
# draft docs always on top
|
||||
if meta.is_submittable:
|
||||
args.order_by = "`tab{0}`.docstatus asc {1}"\
|
||||
.format(self.doctype, (", " + args.order_by if args.order_by else ""))
|
||||
args.order_by = "`tab{0}`.docstatus asc, {1}".format(self.doctype, args.order_by)
|
||||
|
||||
def check_sort_by_table(self, order_by):
|
||||
if "." in order_by:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue