While it is not recommended to change the root type of an account in ERPNext, it is sometimes necessary. You can do this at your own risk. We will not accept any liability with broken systems.
To do this, we have to update 2 fields in each Account: root_type and report_type.
These have to be updated with the system console, change the value assigned to acc.
acc = "703000 - Income Energy- OF"
frappe.db.set_value("Account", acc, "root_type", "Income")
frappe.db.set_value("Account", acc, "report_type", "Profit and Loss")
Example tree view:
It is important to update the whole tree and not just a single child item.
After that, the changes will be visible in Profit and Loss Statement and Trial Balance.