瀏覽代碼

Merge pull request #17824 from frappe/mergify/bp/version-14-hotfix/pr-17816

fix: dont mutate `df` when creating custom fields (backport #17816)
version-14
Sagar Vora 2 年之前
committed by GitHub
父節點
當前提交
4691b73c4c
沒有發現已知的金鑰在資料庫的簽署中 GPG Key ID: 4AEE18F83AFDEB23
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. +3
    -0
      frappe/custom/doctype/custom_field/custom_field.py

+ 3
- 0
frappe/custom/doctype/custom_field/custom_field.py 查看文件

@@ -186,10 +186,13 @@ def create_custom_fields(custom_fields, ignore_validate=False, update=True):
field = frappe.db.get_value("Custom Field", {"dt": doctype, "fieldname": df["fieldname"]})
if not field:
try:
df = df.copy()
df["owner"] = "Administrator"
create_custom_field(doctype, df, ignore_validate=ignore_validate)

except frappe.exceptions.DuplicateEntryError:
pass

elif update:
custom_field = frappe.get_doc("Custom Field", field)
custom_field.flags.ignore_validate = ignore_validate


Loading…
取消
儲存