浏览代码

[fix] Disabled document not validated on save/submit #10571 (#4195)

* validation for disabled document

* Update utils.py
version-14
Utkarsh Goswami 7 年前
committed by Rushabh Mehta
父节点
当前提交
13a3205277
共有 1 个文件被更改,包括 9 次插入2 次删除
  1. +9
    -2
      frappe/desk/form/utils.py

+ 9
- 2
frappe/desk/form/utils.py 查看文件

@@ -29,8 +29,15 @@ def validate_link():
frappe.response['message'] = 'Ok'
return

valid_value = frappe.db.sql("select name from `tab%s` where name=%s" % (frappe.db.escape(options),
'%s'), (value,))
#if enabled/disabled field is present
condition = ""
if frappe.get_meta(options).get_field('disabled'):
condition = " and `disabled` = 0"
elif frappe.get_meta(options).get_field('enabled'):
condition = " and `enabled` = 1"

valid_value = frappe.db.sql("select name from `tab{0}` where name=%s {1}".format(frappe.db.escape(options),
condition), (value,))

if valid_value:
valid_value = valid_value[0][0]


正在加载...
取消
保存