Added Field Read Only checkbox in Customize Form Fields
This commit is contained in:
parent
0b1fe51ae3
commit
5d63553f6a
2 changed files with 31 additions and 2 deletions
|
|
@ -46,7 +46,8 @@ class CustomizeForm(Document):
|
|||
'depends_on': 'Data',
|
||||
'description': 'Text',
|
||||
'default': 'Text',
|
||||
'precision': 'Select'
|
||||
'precision': 'Select',
|
||||
'read_only': 'Check'
|
||||
}
|
||||
|
||||
allowed_fieldtype_change = (('Currency', 'Float', 'Percent'), ('Small Text', 'Data'),
|
||||
|
|
@ -140,6 +141,12 @@ class CustomizeForm(Document):
|
|||
elif property == "unique":
|
||||
update_db = True
|
||||
|
||||
elif (property == "read_only" and cint(df.get("read_only"))==0
|
||||
and frappe.db.get_value("DocField", {"parent": self.doc_type, "fieldname": df.fieldname}, "read_only")==1):
|
||||
# if docfield has read_only checked and user is trying to make it editable, don't allow it
|
||||
frappe.msgprint(_("You cannot unset 'Read Only' for field {0}").format(df.label))
|
||||
continue
|
||||
|
||||
self.make_property_setter(property=property, value=df.get(property),
|
||||
property_type=self.docfield_properties[property], fieldname=df.fieldname)
|
||||
|
||||
|
|
|
|||
|
|
@ -334,6 +334,28 @@
|
|||
"unique": 0,
|
||||
"width": "50px"
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "read_only",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Read Only",
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
|
|
@ -687,7 +709,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"modified": "2015-09-04 02:49:57.129449",
|
||||
"modified": "2015-10-01 07:59:15.490247",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Custom",
|
||||
"name": "Customize Form Field",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue