import frappe

def execute():
    """Remove old column break and section break fields for won/lost"""

    fields_to_remove = [
        "won_lost_column_break",
        "won_lost_section_break_end"
    ]

    for fieldname in fields_to_remove:
        if frappe.db.exists("Custom Field", {"dt": "Sales Invoice", "fieldname": fieldname}):
            try:
                custom_field_name = frappe.db.get_value("Custom Field",
                    {"dt": "Sales Invoice", "fieldname": fieldname}, "name")
                frappe.delete_doc("Custom Field", custom_field_name)
                print(f"Deleted field: {fieldname}")
            except Exception as e:
                print(f"Failed to delete {fieldname}: {e}")

    frappe.db.commit()
    print("Cleanup completed")
