diff --git a/frappe/custom/doctype/customize_form/customize_form.py b/frappe/custom/doctype/customize_form/customize_form.py index e42f617a39..085e632545 100644 --- a/frappe/custom/doctype/customize_form/customize_form.py +++ b/frappe/custom/doctype/customize_form/customize_form.py @@ -68,6 +68,8 @@ allowed_fieldtype_change = (('Currency', 'Float', 'Percent'), ('Small Text', 'Da ('Text', 'Data'), ('Text', 'Text Editor', 'Code', 'Signature'), ('Data', 'Select'), ('Text', 'Small Text')) +allowed_fieldtype_for_options_change = ('Read Only', 'HTML', 'Select',) + class CustomizeForm(Document): def on_update(self): frappe.db.sql("delete from tabSingles where doctype='Customize Form'") @@ -197,6 +199,10 @@ class CustomizeForm(Document): frappe.msgprint(_("You cannot unset 'Read Only' for field {0}").format(df.label)) continue + elif property == "options" and df.get("fieldtype") not in allowed_fieldtype_for_options_change: + frappe.msgprint(_("You can't set 'Options' for field {0}").format(df.label)) + continue + self.make_property_setter(property=property, value=df.get(property), property_type=docfield_properties[property], fieldname=df.fieldname) diff --git a/frappe/custom/doctype/customize_form/test_customize_form.py b/frappe/custom/doctype/customize_form/test_customize_form.py index ffa82c3b00..87f0a6324f 100644 --- a/frappe/custom/doctype/customize_form/test_customize_form.py +++ b/frappe/custom/doctype/customize_form/test_customize_form.py @@ -165,22 +165,22 @@ class TestCustomizeForm(unittest.TestCase): df = d.get("fields", {"fieldname": "title"})[0] # invalid fieldname - df.options = """{doc_type} - {introduction_test}""" + df.default = """{doc_type} - {introduction_test}""" self.assertRaises(InvalidFieldNameError, d.run_method, "save_customization") # space in formatter - df.options = """{doc_type} - {introduction text}""" + df.default = """{doc_type} - {introduction text}""" self.assertRaises(InvalidFieldNameError, d.run_method, "save_customization") # valid fieldname - df.options = """{doc_type} - {introduction_text}""" + df.default = """{doc_type} - {introduction_text}""" d.run_method("save_customization") # valid fieldname with escaped curlies - df.options = """{{ {doc_type} }} - {introduction_text}""" + df.default = """{{ {doc_type} }} - {introduction_text}""" d.run_method("save_customization") # undo - df.options = None + df.default = None d.run_method("save_customization")