Repeating Tasks in ERPNext

HI everyone

We’re planning on working on creating a “Daily Checklist” in ERPNext for people who have daily tasks and need to have these tasks created and done every day. It’s similar to the case mentioned by a user here : There is some tasked repeated every day

Would it be better for development to start with a Standalone Custom Application? (Users can get the app, install it and try it on their ERPNext instances)

OR should we develop the features and submit a pull request once the development is done?

You can view the wireframe and proposed features here : Daily Checklist Proposal - Google Docs

Your comments and suggestions are highly appreciated.

Thanks!

2 Likes

Isn’t this possible with Projects and Tasks? You can create a Project with a list of Tasks. Next day, you can duplicate the project and the tasks will be copied over.

For creating them automatically, we can use Subscription feature.

What do you think?

3 Likes

The problem with this case is if the tasks are to be executed daily, it means that the project and the tasks need to be duplicated daily. And the tasks being executed/repeated daily belong to just 1 project. We’ll end up with too many projects with the same name. And tracking the project details will become rather messy.

We also considered adding an ‘Is Repeating’ checkbox in Task. If checked, a task for that day will be auto-generated. However, this means that the Tasks Child table in project will also get very long. 1 task being repeated in a quarter would mean having 100-120 rows in that project table (and projects could have more than 1 task. Just imagine having 5 tasks and repeating it 300 times in one year).

So far, the checklist thing was the best idea we could think of which would avoid duplicating projects and avoid very long child tables. I think we can use the subscription feature instead of hardcoding the repeating tasks so thank you for that @netchampfaris . We’re open to any suggestions. The more brains and brain cells, the better. :slight_smile:

5 Likes

I have given this a lot of thought too and this is a very generic need (even we need it!). The best way to implement this is to extend the Subscription feature to be made more generic so that it can make any document “repeatable”.

Abstract out the code from Subscription and make a new DocType in the framework (Auto Repeat) to make any document repeatable. Then just add a link the menu of each form to say “Repeat”.

Fields for Auto Repeat

  • DocType
  • Name
  • Date Field
  • Frequency
    • Daily (check days)
    • Weekly (set day of the week)
    • Monthly (set month of the day)

PS: I think this feature also exists in “Event” so maybe Subscription and Event can just extend “Auto Repeat”

10 Likes

That’s a great idea @rmehta. :slight_smile:

I’ll look into both the Auto Repeat feature in Event and Subscription.

Thank you very much and cheers.

1 Like

@littlehera
Did you get through? How you manage you repeat task now?
Thanks

@Sam_NAVARRO Auto repeat will be available in V11 release

1 Like

Great News :blush: @hereabdulla

1 Like

this is not active.

Auto Repeat is already available in V11. :slight_smile: If you want to try it out, please update your version to the latest one @Ravi_Shrivastav .

Hi @littlehera

Trust you’re doing great. Yes, Auto Repeat is in v11 but the only doctypes you can select are transactional documents (i.e. Sales Order, Invoice etc). How do you ‘activate’ it for Tasks and other doctypes?

Kind regards,

Hi @wale,

Been out of the loop for a while. Sorry.

@tundebabzy was the one who worked on the Auto Repeat feature.

If anything, maybe someone can create a feature request for this one?

Cheers.

Hi, I was wondering if this was implemented for other project tasks also? While working on a project, a task is to be repeated daily. As of now, the workaround is that I create the same task for each every day. For example, when working on an agriculture project, a task like “apply pesticide” is to be done every 2 weeks. As of now, in the project template, I have to ensure that a project line-item is added for every two weeks manually.

Thanks,
kshitij

Hello @Kshitij_Sharma,

As @wale said:

I’m not sure if there have been developments to add tasks to autorepeat. Maybe someone can do a feature request for this and post it to this thread?

Alternatively, if you need the feature as a custom app or a customization to your forked repo, then maybe a service provider can help you with the development.

Regards,

Hera

I actually created a Github issue for this over a year ago:

https://github.com/frappe/erpnext/issues/16525

@tundebabzy promised to take a look if he could squeeze out some free time. I do hope someone gets to work on it soon… it’d be a really useful feature

Cheers!

1 Like

Thanks for the info @wale!

I’ve been focusing on a client’s project so I haven’t been able to keep up with the new features but if I have time, I’ll try to look at the Auto Repeat Feature and maybe work on something.

Cheers.

2 Likes

@littlehera hi sis, I’m having nearly the same issue as you had. but the different scenario of mine is we have tasks for a project but we want tasks repeated as much as we wanted to. to make it clear I will have a project for a socket Installation for ZXY company and the tasks I mentioned are just for only per socket but if I have 40 sockets remaining I have to create tasks for them again and again just for only that project the reason we create a task for per socket is to know the costing and billing amount per task. the worst scenario is I have to create a timesheet for each of them manually. and also I gave the Hrs. in time sheet and it will calculate the time and predict the To date … imagine if you planed 24 hrs for a task and the system calucate the ending time as if the emoloyee will work 24 hrs a day… please tell me how to solve this problem. I would really appreciate the help

Has there been any progress in this area?
My research seems to tell me that we can enable Auto Repeat on other doc types, but the documents will be copied with all field statuses in tact. For example, a completed task will be created as a completed task (this isn’t helpful since we would usually want it to be an open task)

My feature request here would allow us to specify which fields should be updated when AutoRepeating a specific document: Allow setting value of DocType fields when Auto-Repeating · Issue #46850 · frappe/erpnext · GitHub

To follow up on this, I’ve been able to implement a kind of repeating task that properly resets the field values using a server script:

'''
This script works in conjunction with AutoRepeat documents to properly repeat 
Tasks. By default, an AutoRepated task will be re-created with all of the old
task's field values (including old dates and completion-related field values)

Before a new Task is inserted, we check to see if the task has an associated
Auto-Repeat document. If it does, we get the frequency and add that to today's
date plus today's time for the start date, and then calculate the new end date
based on the original task's length.
'''

# Only reset fields if the document has an AutoRepeat associated with it
if doc.auto_repeat:
    # Set default repeats to 0
    minutes=0
    hours=0
    days=0
    weeks=0
    months=0
    years=0
    # Get frequency from AutoRepeat document
    freq = frappe.get_doc("Auto Repeat", doc.auto_repeat).frequency
    if freq == "Yearly":
        years = 1
    if freq == "Half-yearly":
        months = 6
    if freq == "Quarterly":
        months = 3
    if freq == "Monthly":
        months = 1
    if freq == "Weekly":
        weeks = 1
    if freq == "Daily":
        days = 1
        
    # Get old start and end dates before we update them
    old_start_date = doc.exp_start_date
    old_end_date = doc.exp_end_date
    # Get length of original Task
    if old_end_date and old_start_date:
        old_task_num_days = frappe.utils.date_diff(old_end_date, old_start_date)
    else:
        old_task_num_days = 0
    if old_end_date:
        # Get time from original Task (if it exists. As of 5/2/2025, star/end dates are of type `Date`, not `Datetime`)
        # This should change to `Datetime` in a future version
        if old_end_date.hour: hours = old_end_date.hour
        if old_end_date.minute: minutes = old_end_date.minute 
        doc.exp_end_date = frappe.utils.add_to_date(frappe.utils.today(), 
                minutes=minutes, hours=hours, days=days, weeks=weeks, months=months, years=years)
    # Update new task's start date (Today's date plus auto repeat frequency plus original tasks' start time)
    if old_start_date:
        # Get time from original Task (if it exists. As of 5/2/2025, star/end dates are of type `Date`, not `Datetime`)
        # This should change to `Datetime` in a future version
        if old_start_date.hour: hours = old_start_date.hour
        if old_start_date.minute: minutes = old_start_date.minute 
        # Set new task start date (and time) based off end date if it exists, otherwise off of today's date
        if old_end_date:
            doc.exp_start_date = frappe.utils.add_to_date(doc.exp_end_date,
                minutes=minutes, hours=hours, days=-old_task_num_days)
        else: # Set new task start date (and time)
            doc.exp_start_date = frappe.utils.add_to_date(frappe.utils.today(), 
                minutes=minutes, hours=hours, days=days, weeks=weeks, months=months, years=years)

    # Assign task to specified users (Requires custom field (custom_assign_repeat_to) linked to custom child table
    # Reset fields to default values
    doc.completed_on = None
    doc.completed_by = None
    doc.progress = 0
    doc.actual_time = 0
    # field (Doctype: Task Assignees; Field: user)
    for assignee in doc.custom_assign_repeat_to:
        todo = frappe.get_doc(
            {"doctype": "ToDo",
            "allocated_to": assignee.user,
            "description": doc.subject,
            "reference_type": "Task",
            "reference_name": doc.name,
            "date": doc.exp_end_date,
            "assigned_by": "developers@empirenatgas.com"
            }).insert(ignore_permissions=True)
    doc.save()
1 Like