Skip to content

Interesting Bench Console Snippets

Jignesh Greycube edited this page Mar 12, 2021 · 1 revision

To duplicate BOM without Operations



for d in frappe.get_all("BOM", filters={"with_operations": 1}):
        doc = frappe.copy_doc(frappe.get_doc("BOM", d.name))
        doc.with_operations = 0
        doc.save()
        doc.submit()

frappe.db.commit()

To create regional custom fields


from erpnext.regional.united_arab_emirates.setup import setup
setup()

To drop all unused custom fields

will delete obsolete column in db.. fields which have been deleted from doctype (or deleted custom fields in customize form)



frappe.model.meta.trim_tables() 
frappe.db.commit()

Clone this wiki locally