Jasper Erpnext Integration

Hi.

I finish my app - Jasper Erpnext Report - two month ago, but only now i have some spare time to fix the coming bugs.

So, i need your help. Please install the app and send me the founded bugs!

Maybe you can find my app useful. Help me make it better!

If you can make my code better, please send me a pull request.

To install please follow this paper: Jasper Erpnext Report

Any question you can post in gitter (address in the same page) or send me an email.

Thanks.

8 Likes

Thanks @luisfmfernandes, now we really need that page for apps / exensions :smile:

1 Like

Yes!!! We need that touch!

I believe when we have that page for apps/extensions more apps will come!

Now i just need feedback to fix the bugs.

Thanks.

i definitely agree about 3rd party apps / extensions!

Hi,
The integration of Jasper went well and I am able to generate my reports. Could you give me an example of how the report could be displayed on click of a button, instead of from the upper-right corner?

TIA
krithi

Hi. Sorry but i don’t understand your question. Could you please be more specific. Thanks.

The reports that can be generated for the doctype gets listed on the top right corner of the page(see image). I select one of them to generate the report in pdf. However, I want to do the same on click of a custom button in the page, and not from the jasper icon on top right corner.

On analysing jasper_erpnext_report.js, I found that functions like jasper.getList() and jasper.getQueryReportList() are invoked on hashchange :

$(window).on(‘hashchange’, function() {…}

I need help in invoking this on click of my custom button.

Any help would be much appreciated.

Thanks
Krithi

Let us see if i understand?

I change the code to easy the process.
So,
If your reports are for Form ou List you must call first:

The following call is for jasper to get the reports that are associated with the doctype and put them in jasper.pages[“any name”].

jasper.getListOnly("any name", "doctype name")

Where ‘any name’ is any name of course!
And doctype name is the name of the doctype, Ex. User.
And then call:

The following call get the report:

jasper.getOrphanReport({jr_name: "try_COA", jr_format: "pdf", page: "the any name chosen before", doctype_type:"Form or List", doctype:"User", docids:["luisfmfernandes@gmail.com", "Administrator"]})

In page you must use the name you choose in any name.
docids are the docnames
doctype_type is Form or List for now!

If your reports are of type general, then:

You don’t need to call jasper.getListOnly.

Just call:
jasper.getOrphanReport({jr_name: “try_COA”, jr_format: “pdf”, docids:[]})

Pass docids: []. This way jasper will not ask you to select at least one element when in List View.

If you have any problem or find any error just tell me.

If forgot, you must update jasper!!

Thanks.

Thanks Fernandes. I tried to display the Cherry report(thats one of the examples) onload of user.js by calling the following functions:

jasper.getListOnly(“testName”, “User”);
jasper.getOrphanReport({jr_name: “Cherry Local”, jr_format: “pdf”, page: “testName”, doctype_type:“Form or List”, doctype:“User”, docids:[“krithi.ramani@gmail.com”, “Administrator”]});

But i get this error in my console:

Uncaught TypeError: Cannot read property ‘locale’ of undefined.

This happens when I set the locale to ‘India’ or ‘Ask’. robj in the following code seems to be undefined.

jasper.check_for_ask_param=function(rname,page,callback){
var robj=jasper.get_jasperdoc_from_name(rname,page);
var ret;
if(robj.locale===“Ask”||(robj.params&&robj.params.length>0)){
ret=jasper.make_dialog(robj,rname+" parameters",callback);}
else{
callback({abort:false});}};

The report however gets listed in the top right corner without any error.
Any clues??

TIA

Hi, thanks for your feedback.

you have an error in doctype_type filed of jasper.getOrphanReport. You must choose Form or List and not both. Try with Form:

jasper.getOrphanReport({jr_name: "Cherry Local", jr_format: "pdf", page: "testName", doctype_type:"Form", doctype:"User", docids:["krithi.ramani@gmail.com", "Administrator"]});

Thanks. But I still get the same error!!!

The error is because jasper don’t find your report.

Do you have Cherry Local report? In the image you provide you only have try_COA, try_Labels and try_ROA.

Still if you have Cherry Local report it must be associated to User doctype in my case is.

Try your try_COA report.
In my case here is the definition of Cherry Local report:

Hi,
I wanted to check the report generation from button click with one of the example reports. I had created Cherry based on your instructions in config.txt. It wasn’t there initially, I created it later. I am also able to generate it from the top right corner in User page…attached are the screenshots

Uploading Screenshot from 2015-10-03 05^%28^%49.png…

Uploading Screenshot from 2015-10-03 05^%39^%55.png…

Hi. It is very strange because i can generate my Cherry Local report that way.

Also, i can’t see your uploaded images.

Please, after command jasper.getListOnly("testName", "User") check if jasper.pages has Cherry local:

testName: {Custom Cherry Local 2: Object, Cherry Local: Object, Custom Cherry Local: Object, size: 3}

Please try the example from browser console. To see if the problem is in your user.js.

Sorry, it was my mistake. Just update jasper and everything is fix now… i hope!

It was a naive mistake!

now, put in your user.js this:

var list_reports = jasper.getListOnly("testName", "User");
list_reports.done(function(){
	jasper.getOrphanReport({jr_name: "Cherry Local", jr_format: "pdf", page: "testName", doctype_type:"Form", doctype:"User", docids:["luisfmfernandes@gmail.com", "Administrator"]});
});

Let me know.

Thanks.

Thanks a bunch, works like a charm. I need your help in few other things:

  1. How do I upload the jrxml files that has subreports? I get “Remove first the file (None) associated with this document or (None) is a wrong parent.” irrespective of the order I upload the files(parent first and then subreport or vice versa).

  2. One of my jrxml is not getting compiled and .jasper file is not created on uploading to Jasper Report. However the jrxml gets compiled without any problems in the Jasper studio. Is there a way I can track the issue?..The console just throws

Caused By:java.io.FileNotFoundException : /site1.local/jasper/try_Labels/compiled/Labels.jasper

  1. If I allow the report to ‘Ask’ for locale at runtime, I have no issues and the report gets downloaded easily.However, if I select the Locale as ‘India’ while creating a Jasper Report, I get the following error in the js console:

"Uncaught TypeError: Cannot read property ‘try_COA’ of undefined "

I sure would like to avoid this prompt at runtime. How should I do it?

Your quick response is much appreciated. thanks again.

Hi. Thanks for your support, i appreciate you to let me know of any error.

I will see if anything is wrong, but meanwhile i need to check if you are doing things write.

To answer to your 1. question, tell me: Are you putting one report inside another, like this:

The error you get is because you are putting another report and you already has one. You have to put the 2º report inside the first report, as a child in the tree structure.