Merge pull request #10753 from deepeshgarg007/custom_field_validate
This commit is contained in:
commit
fa0a94575c
1 changed files with 5 additions and 0 deletions
|
|
@ -72,6 +72,11 @@ class CustomField(Document):
|
|||
frappe.db.updatedb(self.dt)
|
||||
|
||||
def on_trash(self):
|
||||
#check if Admin owned field
|
||||
if self.owner == 'Administrator' and frappe.session.user != 'Administrator':
|
||||
frappe.throw(_("Custom Field {0} is created by the Administrator and can only be deleted through the Administrator account.").format(
|
||||
frappe.bold(self.label)))
|
||||
|
||||
# delete property setter entries
|
||||
frappe.db.sql("""\
|
||||
DELETE FROM `tabProperty Setter`
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue