cr.execute("delete from ir_ui_menu where (id not in (select parent_id from ir_ui_menu where parent_id is not null)) and (id not in (select res_id from ir_values where model='ir.ui.menu'))")
cr.commit()
+# -------------------------------- #
+# remove active to account_account #
+# -------------------------------- #
+
+cr.execute("alter table account_account drop active")
+cr.commit()
+
cr.close()