# A solution to repeating events

**URL:** <https://farmos.discourse.group/t/a-solution-to-repeating-events/2519>\
**Category:** Using farmOS\
**Tags:** workflow\
**Created:** [May 6, 2026, 9:28pm UTC](https://farmos.discourse.group/t/a-solution-to-repeating-events/2519 "2026-05-06T21:28:14Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![pat](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/pat/32/1050_2.png) [@pat](https://farmos.discourse.group/u/pat)\
**Post date:** [May 6, 2026, 9:28pm UTC](https://farmos.discourse.group/t/a-solution-to-repeating-events/2519/1 "2026-05-06T21:28:14Z")

</div>

It’s been a few years since I started using farmOS. I always wanted some task managment for my pig business : What needs to be done when.

I have this spreadsheet telling me everything. All important dates a couple of years ahead.  
Great for planning, but for week to week overview, not so good. The solution for me has been a calendar app,

In my pig barn there are 3 group of sows. It takes 22 weeks form one sows farrowing until next farrowing. And there are 7 weeks between each groups farrowings.  
(That’s actually 7+7+8 weeks, because of biology and the 22 weeks.)

And during each 22 weeks period there are tasks to be done, at correct time.

farmOS don’t support this very well.

I came up with a decent module for this, and I think I managed to generalize it enough so it can be used by any usecase (I can think of..)

I call it farm\_rotation. It creates a menu item in the left farmos-menu, and has 2 views, and one settings page. It might seem complex to set up at first, but its actually very simple.

 ![image](https://global.discourse-cdn.com/free1/uploads/farm_os/original/2X/8/891de9ec6c9151ec85edbd3b8726655a85250f8d.png)

In the setings page I define what I call each batch, series, group or whatever. And how many of them.  
Then the weeks between each series.  
And eventually the tasks. We can se in the image that at day 116 after the series start, there is a farrowing. The 0 at the end tells the module that this is usually not needed as a log.  
Vaccine on the other hand, would be a nice pending activity log, and is marked with a 1 at the end.

In the “Plan” page, we can see all the dates generated

 ![image](https://global.discourse-cdn.com/free1/uploads/farm_os/original/2X/d/d6c25ecf2f58484e0b133bb43641966c362c2711.png)

And then there’s the Scedule view:

 ![image](https://global.discourse-cdn.com/free1/uploads/farm_os/original/2X/d/d635633badecaea85d3d7e0fd2157d187392dbc5.png)Here the events ending with 1 is already preselected, and you can create pending activity logs with the button.

---

<div class="post-metadata">

**Author:** ![mstenta](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/mstenta/32/4_2.png) [@mstenta](https://farmos.discourse.group/u/mstenta)\
**Post date:** [May 7, 2026, 11:04am UTC](https://farmos.discourse.group/t/a-solution-to-repeating-events/2519/2 "2026-05-07T11:04:41Z")

</div>

Awesome! Thanks for sharing this @pat!

Repeating events has been on my mind again recently - every year around this time I wish there was a better way to do it than just cloning logs, which is my current workaround 😅.

I like your strategy! It seems very useful for contexts where the set of events are always the same and count off in days from a start date. Reminds me a bit of the [Template](https://www.drupal.org/project/farm_template) module @paul121 started working on.

Curious what others think of this approach.

Question: would this work for very simple repeating tasks, like something you need to do each month?

Also, I’ll cross-link a few older threads for context:

> **[Recurring tasks](https://www.drupal.org/project/farm/issues/2962368)**
>
> Problem/Motivation A common request is for farmOS to provide an easy way to manage recurring tasks, so that they always show up in your todo list daily/weekly/yearly/etc. For example: https://github.com/farmOS/farmOS/issues/78 If farmOS were like a...

> [@Workflow to map waterbars in road and create recurrent maintence task?](https://farmos.discourse.group/t/workflow-to-map-waterbars-in-road-and-create-recurrent-maintence-task/457/5):
>
> But certainly a cron job + python script would work too! Just to further this thought a bit… Drupal provides a hook\_cron() that can be used to run PHP code on a regular basis within a Drupal module. So if you are experimenting with custom farmOS modules at all that could be useful. Here is the documentation for that in [api.drupal.org](http://api.drupal.org): [https://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook\_cron/7.x](https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_cron/7.x) Of course, the prerequisite to that is setting up your normal system cro…

> [@Recurring Activity Log](https://farmos.discourse.group/t/recurring-activity-log/1561):
>
> Is there a way to create an activity log on a recurring basis? For example, cleaning barn first of the every month, counting dead animals every two days, etc.

> [@Template module](https://farmos.discourse.group/t/template-module/2054):
>
> Happy to share that the Template module we have been working on is ready for review and testing! smile Note: This module is not ready for production! Please do not install it on your production farmOS instances. I expect there to be a few more breaking changes as we test things out. I’ve prepared some documentation (still a wip): [Farm Template](https://project.pages.drupalcode.org/farm_template/) To test, you can use the [farmOS demo site](https://farmos-demo.rootedsolutions.io/). First enable the farm\_template module from the setup page and then go to Setup → Templates to get started …

---

<div class="post-metadata">

**Author:** ![pat](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/pat/32/1050_2.png) [@pat](https://farmos.discourse.group/u/pat)\
**Post date:** [May 7, 2026, 11:48am UTC](https://farmos.discourse.group/t/a-solution-to-repeating-events/2519/3 "2026-05-07T11:48:19Z")

</div>

> [@mstenta](#):
>
> I like your strategy! It seems very useful for contexts where the set of events are always the same and count off in days from a start date. Reminds me a bit of the [Template](https://www.drupal.org/project/farm_template) module @paul121 started working on.

Yes. This is useful indeed to keep track of important dates way ahead of time.  
Easy to setup.

> [@mstenta](#):
>
> Question: would this work for very simple repeating tasks, like something you need to do each month?

Well, if it has to be done very 2. of each month, or always on a monday : no.  
Every 30. day, no problem.

For the pig management scenario the days from first event is essential.  
But for bulk-creating logs each month, it’s maybe not critical if due date misses by a day or two. Not ideal of course.

I’m sure it’s possible to enhance the logic

`5|Do something useful|1`  
This will add the event “Do something useful” 5 days after the start date, and check the box for log creation

`monthly:2:wed|Check tractor|1`

This could possibly add the event “Check tractor” every 2nd wednesday each month. And check the box. No logic for this yet tho.. But should be possible.

---

<div class="post-metadata">

**Author:** ![mstenta](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/mstenta/32/4_2.png) [@mstenta](https://farmos.discourse.group/u/mstenta)\
**Post date:** [May 7, 2026, 1:59pm UTC](https://farmos.discourse.group/t/a-solution-to-repeating-events/2519/4 "2026-05-07T13:59:49Z")

</div>

This is great. I’m still eager to explore something along the lines of a “recurring task plan type” like I described here - perhaps as a (the first) core plan type: [Client Challenge](https://www.drupal.org/project/farm/issues/2962368)

Seeing how you approach this is very helpful, and maybe we can come up with something that provides different types of logic depending on what’s needed, with the same end result (automatically creating logs ahead of time).

Combine that with email notifications to tell me what I need to do today, and it will save me a lot of thinking (and forgetting)! 🚀 😄

---

<div class="post-metadata">

**Author:** ![pat](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/pat/32/1050_2.png) [@pat](https://farmos.discourse.group/u/pat)\
**Post date:** [May 7, 2026, 2:41pm UTC](https://farmos.discourse.group/t/a-solution-to-repeating-events/2519/5 "2026-05-07T14:41:06Z")

</div>

Cool.

> [@mstenta](#):
>
> Combine that with email notifications to tell me what I need to do today, and it will save me a lot of thinking (and forgetting)! 🚀 😄

Exactly

---

<div class="post-metadata">

**Author:** ![pat](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/pat/32/1050_2.png) [@pat](https://farmos.discourse.group/u/pat)\
**Post date:** [May 9, 2026, 6:29am UTC](https://farmos.discourse.group/t/a-solution-to-repeating-events/2519/6 "2026-05-09T06:29:32Z")

</div>

Propably wise to have some kind of checking to avoid duplicate logs.

---

<div class="post-metadata">

**Author:** ![gbathree](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/gbathree/32/286_2.png) [@gbathree](https://farmos.discourse.group/u/gbathree)\
**Post date:** [May 12, 2026, 3:31pm UTC](https://farmos.discourse.group/t/a-solution-to-repeating-events/2519/7 "2026-05-12T15:31:05Z")

</div>

Very valuable. Defining these related strategies effectively and when they should be used correctly is really important also.

1. Copying a task - super useful sometimes
2. A plan - defining a connected set of tasks, sometimes repeated (irrigation or weeding is an example), with defined times between them (this, then wait 20 days, then that, etc.)
3. A repeated task - more of a traditional calendar-type style. Repeat this X times till Y date, etc. This is what you’re talking about here.

I’d love to see not only these design patterns clearly defined, but also the ‘when one versus the other’.

Not that helpful to your problem, but it’s also something I’ve dealt with so throwing in my two cents 🙂

---

<div class="post-metadata">

**Author:** ![pat](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/pat/32/1050_2.png) [@pat](https://farmos.discourse.group/u/pat)\
**Post date:** [May 12, 2026, 9:04pm UTC](https://farmos.discourse.group/t/a-solution-to-repeating-events/2519/8 "2026-05-12T21:04:38Z")

</div>

Yes, there are different strategies indeed.  
I like the 2nd one. Didn’t think too much of plans in this case.. 🤔

At least it’s easy to complicate it 😀

---

<div class="post-metadata">

**Author:** ![pat](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/pat/32/1050_2.png) [@pat](https://farmos.discourse.group/u/pat)\
**Post date:** [September 16, 2026, 1:02pm UTC](https://farmos.discourse.group/t/a-solution-to-repeating-events/2519/9 "2026-09-16T13:02:21Z")

</div>

Inspired by the rotation module approach, I came up with a vaccine module.  
The sows are vaccinated in a system related to the mating date. (Or cycle start date)  
It is generalized, and not tied up to pigs only. It does not create any assets or logs.

Maybe it can be an idea for other cases too.

First : Add groups of animals.

 ![bilde](https://global.discourse-cdn.com/free1/uploads/farm_os/original/2X/c/ce325222971558f3cfc4b60a56a5619185de28c6.jpeg)

Next : Add vaccines

 ![bilde](https://global.discourse-cdn.com/free1/uploads/farm_os/original/2X/d/d41a2185b519d1b4d59afbafd899ef23a7f61c4b.jpeg)

Then you have a timeline

 ![bilde](https://global.discourse-cdn.com/free1/uploads/farm_os/original/2X/7/7e127030b4e0f3e25e3e1fee12547f71d11523d2.jpeg)

Setings:

 ![bilde](https://global.discourse-cdn.com/free1/uploads/farm_os/original/2X/3/337a62082bda30f6281b9bb93965d929f7932648.jpeg)

---

<div class="post-metadata">

**Author:** ![mstenta](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/mstenta/32/4_2.png) [@mstenta](https://farmos.discourse.group/u/mstenta)\
**Post date:** [September 16, 2026, 1:18pm UTC](https://farmos.discourse.group/t/a-solution-to-repeating-events/2519/10 "2026-09-16T13:18:09Z")

</div>

This looks awesome @pat! Well done!
