Ledgers taking default cost center instead of selected cost center in sales/purchase transactions

After selecting a cost center for sales and purchase transactions, some ledgers are taking the default cost center instead of the selected cost center. This is causing the profit and loss statement to not show the correct values.

Anyone?

If it’s a serious bug, it may be better raising it on GitHub than here.