From e3d581afdf1e8143be1df583827120a17a09210e Mon Sep 17 00:00:00 2001 From: Sagar Vora Date: Sat, 13 Aug 2022 12:57:03 +0530 Subject: [PATCH] fix: dont mutate `df` when creating custom fields --- frappe/custom/doctype/custom_field/custom_field.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frappe/custom/doctype/custom_field/custom_field.py b/frappe/custom/doctype/custom_field/custom_field.py index 3f00828439..df02ff1429 100644 --- a/frappe/custom/doctype/custom_field/custom_field.py +++ b/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