From 556722ffc190e9c3ea2685d43d588927a8f27d4e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 9 Jun 2014 16:03:36 +0530 Subject: [PATCH] create custom field if not exists --- frappe/core/doctype/custom_field/custom_field.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/frappe/core/doctype/custom_field/custom_field.py b/frappe/core/doctype/custom_field/custom_field.py index ab910eeaca..9188e07b93 100644 --- a/frappe/core/doctype/custom_field/custom_field.py +++ b/frappe/core/doctype/custom_field/custom_field.py @@ -94,10 +94,11 @@ def create_custom_field(doctype, df): frappe.get_doc({ "doctype":"Custom Field", "dt": doctype, - "permlevel": df.permlevel or 0, - "label": df.label, - "fieldname": df.fieldname, - "fieldtype": df.fieldtype, - "options": df.options, - "insert_after": df.insert_after + "permlevel": df.get("permlevel") or 0, + "label": df.get("label"), + "fieldname": df.get("fieldname"), + "fieldtype": df.get("fieldtype"), + "options": df.get("options"), + "insert_after": df.get("insert_after"), + "print_hide": df.get("print_hide") }).insert()