Merge pull request #17816 from resilient-tech/fix-df-mutation
fix: dont mutate `df` when creating custom fields
This commit is contained in:
commit
096cd9a46e
1 changed files with 3 additions and 0 deletions
|
|
@ -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…
Add table
Reference in a new issue