ソースを参照

[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' frappe.response['message'] = 'Ok'
return 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: if valid_value:
valid_value = valid_value[0][0] valid_value = valid_value[0][0]


読み込み中…
キャンセル
保存