ERPNext Foundation ERPNext Cloud Chat Blog Discuss Frappé* Donate

How to make monthly work summary report?


#1

I’m new to making new DocTypes and I want to make a Monthly Work Summary report similar to Daily Work Summary.

There is a Daily Work Summary available out of the box.
In the company I work in we send monthly work reports to a department head.
I’ve made corresponding copies of Daily Work Summary DocTypes

  • Daily Work Summary > Monthly Work Summary
  • Daily Work Summary Settings > Monthly Work Summary Settings
  • Daily Work Summary Settings Company > Monthly Work Summary Settings Company

Also added Department and Send Email On fields.

As I understand I should also create a Scripted Report. I hoped I could copy most of it from daily work summary report but I couldn’t find it in erpnext Report List. If I understand correctly the daily work report has THESE SCRIPTS.

So to sum up my question: what should my next steps be?


#2

Hi,

I think the following changes will be important to make the current system work for you…

  1. Move this line to monthly so that ‘Mail for response’ will be sent each month
  2. Remove the current hour check from here so that it can send mail each month without checking for hour. So mostly the mail will be sent at midnight.

Let me know if it works for you. Other changes (like Renaming Daily -> Monthly, some logic to check if send_summary method is not triggered before getting the responses) might be required to make it perfect.

Thanks,
Suraj


#3

I’m stuck at the very beginning. I didn’t get to the point where I should change the code yet.
What I’m tryinhg to achieve now is to figure out how to properly copy the Daily Work Summary scripts and reuse them.

  • I’m watching video tutorial which sais that after creating DocType (e.g. Monthly Work Summary) corresponding py and json are created automatically. Not sure if this is triggered by creating new DocType (copying from Daily Work Summary* in my case) via erpnext desktop DocType editor or some other operation. Searched through frappe files and could not find Monthly Work Summary doctype files but I coud find Daily Work Summary files under frappe-bench/apps/erpnext/erpnext/hr/doctype/daily_work_summary_settings.
  • I’m not sure where daily summary scripts should copied/renamed.
  • The link you 've provided is to daily_work_summary_group which confuses a bit.

Can’t find documentation that would guide me through this problem.


MY ENV:

  • ERPNext: v10.1.70 (master)
  • Frappe Framework: v10.1.60 (master)

#4

Hi,

For daily work summary, we use scheduler to trigger a particular function daily.
We make configuration for that in hooks.py.
You can get more info about scheduled tasks here

In your case, you need to trigger that function every month.

You can get your starting point and code references from following files

daily_work_summary.py

daily_work_summary_settings.py

For now, you can copy the code from these 2 files to your newly created doctype files i.e, monthly_work_summary.py & monthly_work_summary_settinng.py, update the code accordingly in them and then add an entry of the method from it in hook.py under scheduler_events -> monthly

hooks.py

Also, about that daily_work_summary_group, that doctype was introduced after some refactor in v11. But since you already mentioned you are on v10 you can ignore that.

Best,
Suraj


#5

Should I create monthly_work_summary.py & monthly_work_summary_settinng.py manually? I can not find daily_work_summary* files anywhere. If so where should I put them?


root@erp:/home/frappe# find . -name "*daily_work*"

Spits out following:

./frappe-bench/apps/erpnext/erpnext/hr/doctype/daily_work_summary_settings
./frappe-bench/apps/erpnext/erpnext/hr/doctype/daily_work_summary_settings/daily_work_summary_settings.pyc
./frappe-bench/apps/erpnext/erpnext/hr/doctype/daily_work_summary_settings/daily_work_summary_settings.py
./frappe-bench/apps/erpnext/erpnext/hr/doctype/daily_work_summary_settings/daily_work_summary_settings.js
./frappe-bench/apps/erpnext/erpnext/hr/doctype/daily_work_summary_settings/daily_work_summary_settings.json
./frappe-bench/apps/erpnext/erpnext/hr/doctype/daily_work_summary_settings_company
./frappe-bench/apps/erpnext/erpnext/hr/doctype/daily_work_summary_settings_company/daily_work_summary_settings_company.py
./frappe-bench/apps/erpnext/erpnext/hr/doctype/daily_work_summary_settings_company/daily_work_summary_settings_company.json
./frappe-bench/apps/erpnext/erpnext/hr/doctype/daily_work_summary_settings_company/daily_work_summary_settings_company.pyc
./frappe-bench/apps/erpnext/erpnext/hr/doctype/daily_work_summary
./frappe-bench/apps/erpnext/erpnext/hr/doctype/daily_work_summary/daily_work_summary.json
./frappe-bench/apps/erpnext/erpnext/hr/doctype/daily_work_summary/daily_work_summary.js
./frappe-bench/apps/erpnext/erpnext/hr/doctype/daily_work_summary/daily_work_summary.pyc
./frappe-bench/apps/erpnext/erpnext/hr/doctype/daily_work_summary/daily_work_summary.py
./frappe-bench/apps/erpnext/erpnext/templates/emails/daily_work_summary.txt
./frappe-bench/apps/erpnext/erpnext/templates/emails/daily_work_summary.html

root@erp:/home/frappe# find . -name " *monthly_work*"

returns nothing


#6

@aleksas there is no monthly work summary report


#7

@hereabdulla
The name of the thread is How to make monthly work summary report?


#8

sorry I didnt notice


#9

Yes, you can create those doctypes from UI. On creating doctypes, respective .py files for them will be created automatically.

I think in your first reply you mentioned that you’ve already created corresponding copies of Daily Work Summary DocTypes


#10

That’s the problem. As I’ve mentioned in my first post I’ve created copies of Daily work summary > Monthly work summary doctypes. But as I’ve demonstrated .py files were not created automatically. Please help me figuring out what I’m doing wrong.

FYI: I’m running ErpNext in production mode if that changes anything.


#11

.py files created only when Doctype created with unchecked Custom (checkbox).


#12

I can not uncheck Custom? checkbox. Production/Dev mode issue?


#13

you have to set “developer_mode”: 1 in site_config.json


#14

Thanks @magic-overflow and @surajshetty, got the .py files.

Will resume making report…

Proper INSTRUCTIONS on enabling dev mode.