fusion_claims: cap MOD follow-up email flood with rolling 30-day window
Two daily MOD crons were fighting each other. _cron_mod_schedule_followups created a mail.activity on every MOD order in quote_submitted/awaiting_funding; _cron_mod_escalate_followups unconditionally deleted the activity after sending its one-time reminder email. The activity was recreated every day in a tight loop with no per-period cap — a legitimate 2-4 month wait for a MOD funding decision would generate dozens of activity churn events and a bulk email burst the first time the escalate cron ran against a backlog. Fix: - New fields x_fc_mod_followup_month_count / _month_start / _cap_notified (copy=False) track a rolling window per order. - New config params mod_followup_max_per_month (default 2), mod_followup_window_days (30), mod_followup_max_per_cron_run (10). - _send_mod_followup_email resets the window after 30 days, refuses to send past the cap, and posts a one-shot chatter note explaining why. - _cron_mod_schedule_followups no longer recreates the activity when the cap has been hit and stops daily-bumping x_fc_mod_next_followup_date. - _cron_mod_escalate_followups processes oldest-deadline-first with a per-run throttle, only unlinks the activity on a successful send so humans can still action capped cases manually. - write() resets the rolling counters on any real MOD status change. Deployed to fusion_claims v19.0.8.0.1 on odoo-westin (westin-v19, 36 affected orders) and odoo-mobility (mobility, 2 affected orders).
This commit is contained in:
@@ -116,6 +116,22 @@
|
||||
<field name="key">fusion_claims.mod_followup_escalation_days</field>
|
||||
<field name="value">3</field>
|
||||
</record>
|
||||
<!-- Hard cap on auto follow-up emails per order per 30-day window. -->
|
||||
<record id="config_mod_followup_max_per_month" model="ir.config_parameter">
|
||||
<field name="key">fusion_claims.mod_followup_max_per_month</field>
|
||||
<field name="value">2</field>
|
||||
</record>
|
||||
<record id="config_mod_followup_window_days" model="ir.config_parameter">
|
||||
<field name="key">fusion_claims.mod_followup_window_days</field>
|
||||
<field name="value">30</field>
|
||||
</record>
|
||||
<!-- Per-cron-run throttle so a backlog of stale MOD cases cannot
|
||||
blast 30+ emails in one minute. Remaining orders roll over to
|
||||
the next day's cron run. -->
|
||||
<record id="config_mod_followup_max_per_cron_run" model="ir.config_parameter">
|
||||
<field name="key">fusion_claims.mod_followup_max_per_cron_run</field>
|
||||
<field name="value">10</field>
|
||||
</record>
|
||||
|
||||
<!-- ODSP Settings -->
|
||||
<record id="config_sa_mobility_email" model="ir.config_parameter">
|
||||
|
||||
Reference in New Issue
Block a user