[minor] validate select default is in options
This commit is contained in:
parent
5bbe43ff78
commit
3e82f73672
1 changed files with 2 additions and 0 deletions
|
|
@ -265,6 +265,8 @@ def validate_fields(meta):
|
|||
def check_illegal_default(d):
|
||||
if d.fieldtype == "Check" and d.default and d.default not in ('0', '1'):
|
||||
frappe.throw(_("Default for 'Check' type of field must be either '0' or '1'"))
|
||||
if d.fieldtype == "Select" and d.default and (d.default not in d.options.split("\n")):
|
||||
frappe.throw(_("Default for {0} must be an option").format(d.fieldname))
|
||||
|
||||
def check_precision(d):
|
||||
if d.fieldtype in ("Currency", "Float", "Percent") and d.precision is not None and not (1 <= cint(d.precision) <= 6):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue