Need help with Script Reports

98 views
Skip to first unread message

Addy

unread,
May 7, 2013, 12:46:30 AM5/7/13
to erpnext-dev...@googlegroups.com
Hi,

I have just noticed that a lot is possible with the script reports which is not even possible with the query reports. Hence I would request some help to be provided on creating a script report.

This is what I have done till now:

  1. Created a script report Customer with SO in the system (Document = Customer)
  2. Now created a python file with the name "Customer with SO.py" (note I don't have underscores)
  3. Now I had placed this py file in the reports folder and also under customer folder in the server
  4. But still I am getting this error 
[10:13:34.742] Traceback (innermost last):
  File "../lib/webnotes/handler.py", line 154, in handle
    execute_cmd(cmd)
  File "../lib/webnotes/handler.py", line 189, in execute_cmd
    ret = call(method, webnotes.form_dict)
  File "../lib/webnotes/handler.py", line 206, in call
    return fn(**newargs)
  File "../lib/webnotes/widgets/query_report.py", line 69, in run
    columns, result = webnotes.get_method(method_name)(filters or {})
  File "../lib/webnotes/__init__.py", line 357, in get_method
    __import__(modulename)
 ImportError: No module named customers_with_so.customers_with_so

Kindly let me know what is it that I am missing.

Rushabh Mehta

unread,
May 7, 2013, 12:51:12 AM5/7/13
to erpnext-dev...@googlegroups.com
Aditya,

Create the python file name with lowercase and underscores.

- Rushabh


--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To post to this group, send email to erpnext-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/E9H6nrrYXp4J.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Aditya Duggal

unread,
May 7, 2013, 1:12:01 AM5/7/13
to erpnext-dev...@googlegroups.com
Hi Rushabh,

But I tried that as well, the problem is that I am not able to figure out that whether the py file should be created under the FOLDER of the DOCTYPE it is based on or in the REPORTS folder.

Kindly let me know.

Rushabh Mehta

unread,
May 7, 2013, 1:20:03 AM5/7/13
to erpnext-dev...@googlegroups.com
It should be in the reports folder. See an existing report for more info.


--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To post to this group, send email to erpnext-dev...@googlegroups.com.

Addy

unread,
May 21, 2013, 1:04:12 AM5/21/13
to erpnext-dev...@googlegroups.com
Hi,

I am still struggling to get my first script report working. I have tried to understand the structure of the existing script reports and found that there are some files in the folder of the script report which I think are automatically created:
  • report_name.pyc
  • __init__.pyc
  • report_name.txt
  • report_name.js
  • __init__.py
Now what I have done:
  • Changed an existing report in the Accounts Module from Query to Script Report
  • Created a folder under the patch /var/www/sites/XXX/app/accounts/report/accounts_receivable_by_invoice
  • Created a python file with the same name accounts_receivable_by_invoice
  • Check the report and I got the same error as the one that I have pointed in the first post which is posted below as well.
  • Now the error suggests that my report points towards the wrong module infact it should be pointing towards the module Accounts but somehow it is  taking the report name as the module name.
Honestly, I have tried my level best to understand the script report but somehow my knowledge is so limited that I cannot figure out a simple thing like this, maybe someone can help me in suggesting what is the issue with my report structure.

[10:28:10.193] Traceback (innermost last):
  File "../lib/webnotes/handler.py", line 154, in handle
    execute_cmd(cmd)
  File "../lib/webnotes/handler.py", line 189, in execute_cmd
    ret = call(method, webnotes.form_dict)
  File "../lib/webnotes/handler.py", line 206, in call
    return fn(**newargs)
  File "../lib/webnotes/widgets/query_report.py", line 69, in run
    columns, result = webnotes.get_method(method_name)(filters or {})
  File "../lib/webnotes/__init__.py", line 357, in get_method
    __import__(modulename)
 ImportError: No module named accounts_receivable_by_invoice.accounts_receivable_by_invoice


On Tuesday, May 7, 2013 10:50:03 AM UTC+5:30, rushabh wrote:
It should be in the reports folder. See an existing report for more info.
On 07-May-2013, at 10:42 AM, Aditya Duggal <adi...@rigpl.com> wrote:

Hi Rushabh,

But I tried that as well, the problem is that I am not able to figure out that whether the py file should be created under the FOLDER of the DOCTYPE it is based on or in the REPORTS folder.

Kindly let me know.

--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.

Anand Doshi

unread,
May 21, 2013, 2:41:51 AM5/21/13
to erpnext-dev...@googlegroups.com
Hi Aditya,

Probably the __init__.py file is missing under app/accounts/report/accounts_receivable_by_invoice

Create an empty file with that name and it should start working.

Thanks,
Anand.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.

To post to this group, send email to erpnext-dev...@googlegroups.com.

Addy

unread,
May 21, 2013, 9:45:19 AM5/21/13
to erpnext-dev...@googlegroups.com
Hi Anand,

That worked but I am not sure why am I getting this error since I have just copied the accounts receivable report in the system and pasted it as it is.

[19:12:15.913] Traceback (innermost last):
  File "../lib/webnotes/handler.py", line 154, in handle
    execute_cmd(cmd)
  File "../lib/webnotes/handler.py", line 189, in execute_cmd
    ret = call(method, webnotes.form_dict)
  File "../lib/webnotes/handler.py", line 206, in call
    return fn(**newargs)
  File "../lib/webnotes/widgets/query_report.py", line 69, in run
    columns, result = webnotes.get_method(method_name)(filters or {})
  File "../app/accounts/report/test_accounts_receivables/test_accounts_receivables.py", line 18, in execute
    age_on = getdate(filters.get("report_date")) > getdate(nowdate()) \
  File "../lib/webnotes/utils/__init__.py", line 144, in getdate
    if " " in string_date:
 TypeError: argument of type 'NoneType' is not iterable

Anand Doshi

unread,
May 21, 2013, 9:47:49 AM5/21/13
to erpnext-dev...@googlegroups.com
Hi Aditya,

Please also copy the report's js file. It should solve this error.

Thanks,
Anand.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.

To post to this group, send email to erpnext-dev...@googlegroups.com.

Nabin Hait

unread,
May 21, 2013, 10:15:45 AM5/21/13
to erpnext-dev...@googlegroups.com

Probably you did not changed report name in filter specification in js file. Can you see filters in the loaded report?

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.

To post to this group, send email to erpnext-dev...@googlegroups.com.

Addy

unread,
May 23, 2013, 11:59:32 PM5/23/13
to erpnext-dev...@googlegroups.com

Hi,


Well I am still not able to run a custom script report, I have added the blank __init__.py  file and also the test_accounts_receivables.js file with the name of the report changed but still I am getting the below shown as the report output and no error on the console.



Also the files in the folder /app/accounts/report/test_accounts_receivables/  are attached kindly let me know what is the thing that I am missing now.


To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsubscr...@googlegroups.com.

To post to this group, send email to erpnext-dev...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsubscr...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.
To post to this group, send email to erpnext-dev...@googlegroups.com.
test_accounts_receivables.py
test_accounts_receivables.txt
test_accounts_receivables.js

Nabin Hait

unread,
May 24, 2013, 1:56:24 AM5/24/13
to erpnext-dev...@googlegroups.com
What is the url you are using?

Looking like you are using #Report2/Sales Invoice/Test Accounts Receivables
Instead use #query-report/Test Accounts Receivables

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.

To post to this group, send email to erpnext-dev...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 
<test_accounts_receivables.txt><test_accounts_receivables.py><test_accounts_receivables.js>

Aditya Duggal

unread,
May 24, 2013, 2:08:36 AM5/24/13
to erpnext-dev...@googlegroups.com
Thanks Nabin,

Really over looked the link, now it is working FINALLY. But how could I ensure that the link on the custom report list takes me to the query-report link instead of the report2 link.

On Fri, May 24, 2013 at 11:26 AM, Nabin Hait <nabi...@gmail.com> wrote:
#query-report/Test Accounts Receivables


Nabin Hait

unread,
May 24, 2013, 2:46:31 AM5/24/13
to erpnext-dev...@googlegroups.com
We have fixed the issue, now it will take correct url.

Please pull the latest updates to test it.

--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To post to this group, send email to erpnext-dev...@googlegroups.com.

Aditya Duggal

unread,
May 24, 2013, 3:05:06 AM5/24/13
to erpnext-dev...@googlegroups.com
Thanks Nabin,

Its fixed. I didn't knew that you people would find a bug in the process ;)


Reply all
Reply to author
Forward
0 new messages