Interesting Bench Console Snippets - jigneshpshah/greycube_helpmanual GitHub Wiki

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()

⚠️ **GitHub.com Fallback** ⚠️