[minor] fix document_type in DocType and add 'name' and 'modified' to customize form sort options
This commit is contained in:
parent
acc4252ce7
commit
616098ba0a
2 changed files with 8 additions and 0 deletions
|
|
@ -37,6 +37,7 @@ class DocType(Document):
|
|||
self.validate_series()
|
||||
self.scrub_field_names()
|
||||
self.validate_title_field()
|
||||
self.validate_document_type()
|
||||
validate_fields(self)
|
||||
|
||||
if self.istable:
|
||||
|
|
@ -47,6 +48,12 @@ class DocType(Document):
|
|||
|
||||
self.make_amendable()
|
||||
|
||||
def validate_document_type(self):
|
||||
if self.document_type=="Transaction":
|
||||
self.document_type = "Document"
|
||||
if self.document_type=="Master":
|
||||
self.document_type = "Setup"
|
||||
|
||||
def change_modified_of_parent(self):
|
||||
"""Change the timestamp of parent DocType if the current one is a child to clear caches."""
|
||||
if frappe.flags.in_import:
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ frappe.ui.form.on("Customize Form", {
|
|||
if(frm.doc.doc_type) {
|
||||
var fields = $.map(frm.doc.fields,
|
||||
function(df) { return frappe.model.is_value_type(df.fieldtype) ? df.fieldname : null; });
|
||||
fields = ["", "name", "modified"].concat(fields);
|
||||
frm.set_df_property("sort_field", "options", fields);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue