General Leger: New report, custom field issue

Hi,
I have added new custom field Description in Journal Entry Account form.

After that I create new report General Ledger With Description with Report Type: Script Report.

script report list

Then I copy all the script from general_ledger (.js, py) to my new files. I added filter for Description in JS file.

jsfile

In my Py file I add column description in query.

and

pyfile2

I update these files to my server and run bench migrate command.

I create new journal entry and put the Description in filed.

My new report have Description column in it but with out value.

Please let me know which step I am missing in this process.

Regards,
–Ashfaq

Hi, Your custom field is in Journal Entry Account, and your query is on General Ledger. If you want the description to be copied to Legder, you have to hook on the submit of Journal Entry and copy description to GL. BTW there is a remarks field in Journal Entry which is copied by default.
Thanks

Thanks Ranjith,
Please guide me how to hook on submit Journal entry to GL.

Regards,
–Ashfaq

You have to create a custom app and in the hooks file you have to

doc_events = {
“Journal Entry”: {
“on_submit”: dotted.path.to.the.method
}
}

not sure if you are a developer, please refer app development on frappe.
If you think this requirement is generic consider sending PR to ERPNext.
Thanks,
Best ahead.

Just review this link:
General Ledger Report with custom filed

In the last post the Mr.kxt5258 suggest to check the make_entry method in general_ledger.py file.

def make_entry(args, adv_adj, update_outstanding, from_repost=False):
args.update({“doctype”: “GL Entry”})
gle = frappe.get_doc(args)
gle.flags.ignore_permissions = 1
gle.flags.from_repost = from_repost
gle.insert()
gle.run_method(“on_update_with_args”, adv_adj, update_outstanding, from_repost)
gle.submit()

Is it possible to copy the value of Journal Entry Account Description filed to GL Entry? if yes, how to adjust the above code?

Regards,
–Ashfaq

This can’t be done without changing core code because overriding class method is not possible through hook.
As suggested by @Rajith, use remark field.

If you want to modify core code then check make_gl_entries() in journal_entry.py

Thanks sanjay,
Remark field in Journal Entry account DocType not present, I add custom field in it with the name of remark and then pass a Journal entry, by doing this it does not copy the remark filed in GL Entry document.

Regards,
–Ashfaq

HI,
I have added custom filed Description in Journal Entry Account form. Then I append custom filed in make_gl_entries method which is written in journal_entry.py file.

“description”: d.description

After execute command bench migrate, I create new Journal entry and check it in my new report, that did not worked, my new report display custom column but with out value.

Today I try bench restart command, and create new entry… surprisingly its worked!

Regards,
–Ashfaq

@kietmak. Do u mean that your every account in Journal entry can have differnt description and it will also be shown in General Ledger Report?

Yes, check the below screenshot:

Regards,
–Ashfaq

Great. Please consider sending a PR on github