I want to call Sales Invoice from Journal Entry Account

I want to call Sales Invoice from Journal Entry Account using reference name as a link of Invoice)
frappe.ui.form.on(“Journal Entry Account”, “get_invoice”, function(frm) {
frappe.set_route(“Form”, “Sales Invoice”, “frm.doc.reference_name”)
});

Thanks
Mithilesh

Hi @2002

frappe.ui.form.on("Journal Entry Account", "get_invoice", function(frm, cdt, cdn) { var child = locals[cdt][cdn]; if(child.reference_type == 'Sales Invoice'){ frappe.set_route("Form", child.reference_type, child.reference_name) } });

Thanks, Rohit

Dear Rohit,

Thanks a lot.

It is still giving error.

Traceback (innermost last):
File “/home/frappe/press/benches/1606241046/apps/frappe/frappe/app.py”, line 57, in application
response = frappe.handler.handle()
File “/home/frappe/press/benches/1606241046/apps/frappe/frappe/handler.py”, line 19, in handle
execute_cmd(cmd)
File “/home/frappe/press/benches/1606241046/apps/frappe/frappe/handler.py”, line 36, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “/home/frappe/press/benches/1606241046/apps/frappe/frappe/init.py”, line 806, in call
return fn(*args, **newargs)
TypeError: runserverobj() takes at least 1 argument (1 given)

Thanks

Mithilesh

Hi @2002,

Seems you have select wrong doctype on custom script, Instead of Journal Entry Account select Journal Entry as DocType.
For more detail, check below image.

Thanks, Rohit

Dear Rohit,

Thank you very much.

Thanks

Mithilesh