How to make monthly work summary report?

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?

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

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)

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_eventsmonthly

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

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

@aleksas there is no monthly work summary report

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

sorry I didnt notice

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

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.

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

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

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

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

Will resume making report…

Proper INSTRUCTIONS on enabling dev mode.

@surajshetty, found more time recently for erpnext, so back to this little project. Now I wonder if it makes more sense to change Daily Work Summary to Regular Work Summary with adjustable time intervals:

  • Daily (time)
  • Weekly (week day, time)
  • Monthly (Day of the month [1-31] or [+1,+2,… -2, -1] relative to the month start/end dates, time)
  • Yearly (Month, Day of the month, Time).

The complexity that may arise when formulating the logic for sending emails before/after first/last holiday according to defined frequency, meaning that it’s not enaugh to check is_holiday_today. If summaries are periodic, say monthly, then logic should determine if to send a summary request before vacation (which may start in the middle of the month) or not to send if vacation ends before the end of the month.

@rmehta, @netchampfaris

Sounds like a good proposal :+1:

Current state of things:

The logic is simpler than described above.
There are three options for emails: Request, Summary and Both. As many users can be added with arbitrary variation in email setting.

Intervals are: Daily, Weekly, Monthly and Yearly.
For each corresonding parameters are set (week Day/ day of the month, month)
For both request and summary.

Summary can be set to be “before” the request, wich is a nice consiquence of simple logic that was already in daily summay and communication “engine” in general. For instance request are sent 5 days before the end, and summaries are sent a day or two after the end of the month, which would be configured by setting request day -5 and summary to 2.

The holiday list is checked only for daily requests and vacations or other off days are not checked. The reason is simple - to not overengineer, at least for now.

Actually if holiday logic is kept for daily summaries only, then it would be hidden for other options.

@rmehta, any comments?

PULL REQUEST