Cost Center not updated for old records

We have been using ERPNext since 2017 but have only recently decided to start using Cost Centers. The problem I’m facing is that the financial statements show different values with/without the cost center selected.

This is because the opening balances are showing incorrectly when the cost center is selected, which is most likely happening since not all old journal entries were tagged with the cost center (as checked in GL Entry table).

Is there any way to fix this (maybe by using Accounting Dimensions)? Am I overlooking something?

You may have to run a python script to update cost center on old data.

Would this simply be to update cost center for all GL Entries in the system? Don’t want to mistakenly mess something up.

Typical correction would be to do it for only the P&L accounts. Based on your data you can decide on the way you want to correct it.