(fixed)messed up alignment in script report that extends financial_statements.js

I have a script report that is extending the file apps/erpnext/erpnext/public/js/financial_statements.js. So all the columns in my report and everything is quite messed up and it doesn’t get changed from the python file of my report.
This is how the report looks:

I figured out that it was because of this code in financial_statements.js below:

In the case of my report, the formatter function on line 5 is also receiving undefined value for the parameter called data at some point. Hence it is giving javascript console errors at the line 7 at data.account_name and at the line 16 at !data.parent_account.

So making those conditions a little bit robust by checking for the existence of data like so data && column.fieldname=="account" at line 6 for example and also on line 16 is solving the problem.

And the report looks good:


Thanks a lot! I was having this issue if I checked the “Add Total Row” option. This solved it.

1 Like