From 616098ba0a783159ce3fe9f2baf59b3e7cfb2cd6 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 24 Aug 2015 13:41:54 +0530 Subject: [PATCH] [minor] fix document_type in DocType and add 'name' and 'modified' to customize form sort options --- frappe/core/doctype/doctype/doctype.py | 7 +++++++ frappe/custom/doctype/customize_form/customize_form.js | 1 + 2 files changed, 8 insertions(+) diff --git a/frappe/core/doctype/doctype/doctype.py b/frappe/core/doctype/doctype/doctype.py index 32db08c178..c6d736507b 100644 --- a/frappe/core/doctype/doctype/doctype.py +++ b/frappe/core/doctype/doctype/doctype.py @@ -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: diff --git a/frappe/custom/doctype/customize_form/customize_form.js b/frappe/custom/doctype/customize_form/customize_form.js index 0a8b4e5fb7..d8c08dd289 100644 --- a/frappe/custom/doctype/customize_form/customize_form.js +++ b/frappe/custom/doctype/customize_form/customize_form.js @@ -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); }