* Remove trailing whitespaces * Format code to fit module conventions * Add appropriate new lines between imports, classes, fn defs, etc * Added comments, docstrings & module headers
16 lines
462 B
Python
16 lines
462 B
Python
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
|
# MIT License. See license.txt
|
|
import frappe
|
|
|
|
def add_custom_field(doctype, fieldname, fieldtype='Data', options=None):
|
|
frappe.get_doc({
|
|
"doctype": "Custom Field",
|
|
"dt": doctype,
|
|
"fieldname": fieldname,
|
|
"fieldtype": fieldtype,
|
|
"options": options
|
|
}).insert()
|
|
|
|
def clear_custom_fields(doctype):
|
|
frappe.db.delete("Custom Field", {"dt": doctype})
|
|
frappe.clear_cache(doctype=doctype)
|