Skip to content

[17.0] [IMP] fieldservice_recurring: optimize order generation logic#1487

Open
brian10048 wants to merge 1 commit intoOCA:17.0from
brian10048:17.0-fix-rfo-cron
Open

[17.0] [IMP] fieldservice_recurring: optimize order generation logic#1487
brian10048 wants to merge 1 commit intoOCA:17.0from
brian10048:17.0-fix-rfo-cron

Conversation

@brian10048
Copy link
Copy Markdown
Contributor

I experienced an issue with the field service recurring cron task that generates new orders. A memory limit was reached and the task would fail to execute in some databases that have some fsm_recurring records with a high number of linked fsm_order records

It would always hang in this block of code

        for order in rec.fsm_order_ids:
            if order.scheduled_date_start:
                order_dates.append(order.scheduled_date_start.date())

The order_dates list was used to prevent creating new orders on a date which there already exists an order. However, we do not need to even consider all these dates in the past

This change removes the order_dates list. Instead, the first element of the rruleset is skipped if an order already exists in the recurring. This date is the same as the 'dtstart' parameter which is derived from the last scheduled order

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hi @wolfhall, @max3903,
some modules you are maintaining are being modified, check this out!

@brian10048 brian10048 self-assigned this Dec 18, 2025
@brian10048 brian10048 added this to the 17.0 milestone Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants