refactor: update usage of modified everywhere
This commit is contained in:
parent
270d02df31
commit
dbcf7ad30c
16 changed files with 23 additions and 23 deletions
|
|
@ -24,7 +24,7 @@ export default {
|
|||
naming_rule: "By fieldname",
|
||||
owner: "Administrator",
|
||||
permissions: [],
|
||||
sort_field: "modified",
|
||||
sort_field: "creation",
|
||||
sort_order: "ASC",
|
||||
track_changes: 1,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ export default {
|
|||
naming_rule: "By fieldname",
|
||||
owner: "Administrator",
|
||||
permissions: [],
|
||||
sort_field: "modified",
|
||||
sort_field: "creation",
|
||||
sort_order: "ASC",
|
||||
track_changes: 1,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ export default {
|
|||
},
|
||||
],
|
||||
quick_entry: 1,
|
||||
sort_field: "modified",
|
||||
sort_field: "creation",
|
||||
sort_order: "ASC",
|
||||
track_changes: 1,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ export default {
|
|||
},
|
||||
],
|
||||
quick_entry: 1,
|
||||
sort_field: "modified",
|
||||
sort_field: "creation",
|
||||
sort_order: "ASC",
|
||||
track_changes: 1,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ export default {
|
|||
},
|
||||
],
|
||||
quick_entry: 1,
|
||||
sort_field: "modified",
|
||||
sort_field: "creation",
|
||||
sort_order: "ASC",
|
||||
track_changes: 1,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ export default {
|
|||
write: 1,
|
||||
},
|
||||
],
|
||||
sort_field: "modified",
|
||||
sort_field: "creation",
|
||||
sort_order: "ASC",
|
||||
track_changes: 1,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ export default {
|
|||
write: 1,
|
||||
},
|
||||
],
|
||||
sort_field: "modified",
|
||||
sort_field: "creation",
|
||||
sort_order: "ASC",
|
||||
track_changes: 1,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ export default {
|
|||
cancel: 1,
|
||||
},
|
||||
],
|
||||
sort_field: "modified",
|
||||
sort_field: "creation",
|
||||
sort_order: "ASC",
|
||||
track_changes: 1,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ export default {
|
|||
],
|
||||
quick_entry: 1,
|
||||
autoname: "format: Test-{####}",
|
||||
sort_field: "modified",
|
||||
sort_field: "creation",
|
||||
sort_order: "ASC",
|
||||
track_changes: 1,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ export default {
|
|||
write: 1,
|
||||
},
|
||||
],
|
||||
sort_field: "modified",
|
||||
sort_field: "creation",
|
||||
sort_order: "ASC",
|
||||
track_changes: 1,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2045,7 +2045,7 @@ def get_list(doctype, *args, **kwargs):
|
|||
:param doctype: DocType on which query is to be made.
|
||||
:param fields: List of fields or `*`.
|
||||
:param filters: List of filters (see example).
|
||||
:param order_by: Order By e.g. `modified desc`.
|
||||
:param order_by: Order By e.g. `creation desc`.
|
||||
:param limit_start: Start results at record #. Default 0.
|
||||
:param limit_page_length: No of records in the page. Default 20.
|
||||
|
||||
|
|
@ -2069,7 +2069,7 @@ def get_all(doctype, *args, **kwargs):
|
|||
:param doctype: DocType on which query is to be made.
|
||||
:param fields: List of fields or `*`. Default is: `["name"]`.
|
||||
:param filters: List of filters (see example).
|
||||
:param order_by: Order By e.g. `modified desc`.
|
||||
:param order_by: Order By e.g. `creation desc`.
|
||||
:param limit_start: Start results at record #. Default 0.
|
||||
:param limit_page_length: No of records in the page. Default 20.
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
"allow_import": 0,
|
||||
"allow_events_in_timeline": 0,
|
||||
"allow_auto_repeat": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_field": "creation",
|
||||
"sort_order": "DESC",
|
||||
"document_type": "",
|
||||
"show_preview_popup": 0,
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
"allow_import": 0,
|
||||
"allow_events_in_timeline": 0,
|
||||
"allow_auto_repeat": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_field": "creation",
|
||||
"sort_order": "DESC",
|
||||
"document_type": "",
|
||||
"show_preview_popup": 0,
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ def update_comment(name, content):
|
|||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_next(doctype, value, prev, filters=None, sort_order="desc", sort_field="modified"):
|
||||
def get_next(doctype, value, prev, filters=None, sort_order="desc", sort_field="creation"):
|
||||
prev = int(prev)
|
||||
if not filters:
|
||||
filters = []
|
||||
|
|
|
|||
|
|
@ -1073,16 +1073,16 @@ class DatabaseQuery:
|
|||
if self.doctype_meta.sort_field and "," in self.doctype_meta.sort_field:
|
||||
# multiple sort given in doctype definition
|
||||
# Example:
|
||||
# `idx desc, modified desc`
|
||||
# `idx desc, creation desc`
|
||||
# will covert to
|
||||
# `tabItem`.`idx` desc, `tabItem`.`modified` desc
|
||||
# `tabItem`.`idx` desc, `tabItem`.`creation` desc
|
||||
args.order_by = ", ".join(
|
||||
f"`tab{self.doctype}`.`{f_split[0].strip()}` {f_split[1].strip()}"
|
||||
for f in self.doctype_meta.sort_field.split(",")
|
||||
if (f_split := f.split(maxsplit=2))
|
||||
)
|
||||
else:
|
||||
sort_field = self.doctype_meta.sort_field or "modified"
|
||||
sort_field = self.doctype_meta.sort_field or "creation"
|
||||
sort_order = (self.doctype_meta.sort_field and self.doctype_meta.sort_order) or "desc"
|
||||
if self.order_by:
|
||||
args.order_by = (
|
||||
|
|
@ -1203,9 +1203,9 @@ def get_order_by(doctype, meta):
|
|||
if meta.sort_field and "," in meta.sort_field:
|
||||
# multiple sort given in doctype definition
|
||||
# Example:
|
||||
# `idx desc, modified desc`
|
||||
# `idx desc, creation desc`
|
||||
# will covert to
|
||||
# `tabItem`.`idx` desc, `tabItem`.`modified` desc
|
||||
# `tabItem`.`idx` desc, `tabItem`.`creation` desc
|
||||
order_by = ", ".join(
|
||||
f"`tab{doctype}`.`{f_split[0].strip()}` {f_split[1].strip()}"
|
||||
for f in meta.sort_field.split(",")
|
||||
|
|
@ -1213,9 +1213,9 @@ def get_order_by(doctype, meta):
|
|||
)
|
||||
|
||||
else:
|
||||
sort_field = meta.sort_field or "modified"
|
||||
sort_field = meta.sort_field or "creation"
|
||||
sort_order = (meta.sort_field and meta.sort_order) or "desc"
|
||||
order_by = f"`tab{doctype}`.`{sort_field or 'creation'}` {sort_order or 'desc'}"
|
||||
order_by = f"`tab{doctype}`.`{sort_field}` {sort_order}"
|
||||
|
||||
return order_by
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ frappe.ui.SortSelector = class SortSelector {
|
|||
this.args = {};
|
||||
|
||||
if (order_by.includes("`.`")) {
|
||||
// scrub table name (separated by dot), like `tabTime Log`.`modified` desc`
|
||||
// scrub table name (separated by dot), like `tabTime Log`.`creation` desc`
|
||||
order_by = order_by.split(".")[1];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue