seitime-frappe/frappe/utils/testutils.py
Suraj Shetty c0c5b2ebdd
style: format all python files using black (#16453)
Co-authored-by: Frappe Bot <developers@frappe.io>
2022-04-12 10:59:25 +05:30

20 lines
473 B
Python

# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
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)