Operations

Odoo Google Calendar: why Restart synchronization emails every guest

Restart synchronization in Odoo's Google Calendar module re-sends every future event with guest notifications on. Tested on 18.0 and 20.0, with the fix.

CICDoo Team 6 min read

In short

In Odoo 18.0, 20.0 and master, Restart synchronization marks every synced event for sync and immediately pushes future events to Google with sendUpdates=all, so guests can get Updated invitation emails. _google_patch also ignores the send_updates flag. The fix needs both: run the restart with send_updates=False, and make _google_patch read that flag like _google_insert does.

On this page
  1. What happens when you click Restart synchronization
  2. Why nothing stops the notifications
  3. What we saw when we tested it
  4. Who is affected
  5. The fix: two small changes
  6. What to do until you patch
  7. Need a hand?

If you run Odoo with the standard Google Calendar integration, there is one button you should treat with care: Restart synchronization. On a busy calendar, clicking it pushes every upcoming meeting back to Google with guest notifications switched on. Clients, partners, candidates, suppliers: everyone invited to something in the next twelve months can get an "Updated invitation" email, all at once.

This is not a misconfiguration on your side. It is a bug in Odoo's own google_calendar module, it is present in the current 20.0 branch, it is still in master, and Odoo 18.0 behaves the same way. Upgrading will not make it go away. The fix is two small changes, and we tested both on Odoo 18.0 and 20.0.

What happens when you click Restart synchronization

Users usually reach for this button after something went wrong: the sync was stopped, a token expired, events stopped showing up on one side, or someone reconnected their Google account. Restarting looks like a safe, housekeeping action.

Here is what Odoo actually does behind it. The restart method in res_users.py clears the stopped flag and then marks every event in the user's sync window as needing a sync, by writing need_sync = True on all of them. The sync window is controlled by the system parameter google_calendar.sync.range_days, which defaults to 365 days in the past and 365 days in the future.

That write is the trigger. When an event that already exists on Google is written with need_sync set, Odoo immediately queues an update to Google through a method called _google_patch, which runs as soon as the transaction commits. So the moment the restart is saved, Odoo sends one update per synced event, without waiting for the next synchronization run.

Every Google Calendar API call that changes an event carries a sendUpdates choice. When it is set to all, Google is asked to notify every attendee. That is exactly what you want when a meeting really moves. It is exactly what you do not want when Odoo is only re-sending data Google already has.

Why nothing stops the notifications

Odoo's developers did think about bulk re-sends. In the sync loop in res_users.py, the Odoo to Google pass switches notifications off during a full resynchronization:

send_updates = not full_sync
...
events.with_context(send_updates=send_updates)._sync_odoo2google(calendar_service)

Two things defeat that intent.

First, the restart does not go through this loop for already synced events. Its own write sends the updates straight away, and nothing in the restart sets send_updates to false, so the default applies: notify everyone.

Second, even when a caller does ask for silence, the update path ignores it. In addons/google_calendar/models/google_event_sync.py on 20.0, the insert method _google_insert reads the flag:

send_updates = self.env.context.get('send_updates', True) and not self._is_event_over()

The update method _google_patch, a few lines above, does not:

send_updates = not self._is_event_over()

Whatever the caller asked for, _google_patch notifies guests of every event that has not ended yet. The _is_event_over() check is why past meetings are spared and why the damage lands precisely on your future calendar, the part your guests actually care about.

You can read both methods yourself in the 20.0 source of google_event_sync.py and compare with the same file on master.

What we saw when we tested it

We reproduced the whole flow on fresh Odoo 18.0 and 20.0 databases, with every call to Google intercepted so nothing left the server. Each database had one meeting three days ahead and one three days ago, both already synced and both with an external guest. We then clicked through Stop synchronization and Restart synchronization the way a user would and recorded every request Odoo tried to send.

  • Unpatched, on both versions: the future meeting was sent to Google with sendUpdates=all the moment the restart was saved. The past meeting went out with sendUpdates=none.
  • With only the one line change to _google_patch: no difference. The restart still sent sendUpdates=all, because the restart never asks for silence in the first place.
  • With both changes below: the future meeting went out with sendUpdates=none.
  • A real edit after the fix: moving the future meeting by an hour still sent sendUpdates=all, so genuine changes keep notifying guests.

Who is affected

You are exposed if all of the following are true:

  • You use the standard Odoo Google Calendar integration (the google_calendar module), on Community or Enterprise.
  • Your users have meetings with external attendees synced to Google.
  • Someone clicks Restart synchronization.

The bigger and busier the calendar, the worse it gets. A sales team with recurring client calls, a recruiter with interview slots, or an operations manager with supplier meetings can each have hundreds of future events. Across a team, that quickly turns into thousands of updates pushed to Google within minutes, each one asking Google to notify the guests.

The behaviour is the same in the current 20.0 branch, in master and in Odoo 18.0, so older versions are not a safe harbour either.

The side effects go beyond noise. Guests start asking whether the meeting moved. Some reply, some decline by mistake, some mark the messages as spam, which hurts your domain's sending reputation for weeks afterwards.

The fix: two small changes

1. Make the restart ask for silence. Override restart_google_synchronization on res.users so it runs with notifications switched off. In a small custom module, that is the original method called with send_updates set to false in the context:

def restart_google_synchronization(self):
    return super(ResUsers, self.with_context(send_updates=False)).restart_google_synchronization()

On 20.0 the original method is declared with @api.model, so keep that decorator on your override.

2. Make _google_patch respect the flag, the same way _google_insert already does. Replace:

send_updates = not self._is_event_over()

with:

send_updates = self.env.context.get('send_updates', True) and not self._is_event_over()

You need both. The first change on its own does nothing, because _google_patch throws the flag away. The second on its own does nothing for a restart, because the restart never sets the flag. Together they make the restart silent, and the second change also makes full resynchronizations silent, which is what Odoo intended.

Normal edits made in Odoo still notify guests, because the default stays True. Past events still never notify.

How you apply it depends on how you run Odoo:

  • Self hosted or on your own servers: put both changes in a small custom module, so the fix survives source updates. Patching the core files directly works, but it is overwritten the next time you pull Odoo.
  • Odoo.sh: you cannot edit core files, so the custom module is the only route. Put it in your repository like any other custom addon.
  • Odoo Online (SaaS): you cannot install custom code, so avoid the button until Odoo ships a fix.

Whichever route you take, test it on a staging copy first. Create a meeting with a single test guest you control, connect a test Google account, click Restart synchronization and confirm that no update email arrives. Then edit the meeting time in Odoo and confirm that an update email does arrive. Those two checks prove the fix is silent where it should be and still loud where it should be.

What to do until you patch

If you cannot deploy the fix right away:

  1. Tell your users not to click Restart synchronization. Most people only press it when something looks broken. Ask them to raise a ticket instead.
  2. If a restart is unavoidable, shrink the window first. Lower google_calendar.sync.range_days temporarily to a few days, restart, then set it back. Only events inside the window are marked, so fewer guests are notified. It does not remove the problem, it limits it.
  3. Check your staging and test databases. A copy of production with a live Google connection can trigger the same storm against real attendees. Disconnect Google on every non production database.
  4. Keep an eye on bounces and spam complaints after any sync incident, and warn your most important clients if a wave already went out.

Need a hand?

If you run Odoo with Google Calendar sync and want this patched safely, with a staging test before it reaches production, send us a message. And if someone else on your team manages your Odoo calendar setup, send them this article before they reach for that button.

FAQ

Questions, answered

Does this affect Odoo 20.0?

Yes. We reproduced it on the current 20.0 branch: Restart synchronization sends every synced future event to Google with sendUpdates=all. Master has the same code, and Odoo 18.0 behaves the same way.

Is the one line change to _google_patch enough?

No. In our tests the restart still sent sendUpdates=all with only that change, because the restart never asks for silence. You also need the restart to run with send_updates set to false, as shown in the fix section.

Why are past events not affected?

Odoo checks _is_event_over() before notifying, which disables notifications for events that have already ended. Only events that have not ended yet are sent with notifications, which is why the whole future calendar is hit.

Will the fix stop guests from getting real updates?

No. The default value stays True, so any change you make to a meeting in Odoo still notifies attendees. We checked this after applying the fix: moving a meeting still sent sendUpdates=all.

The CICDoo blog

Get the next post by email

Practical notes on running Odoo in production, sent when a new post goes up. No spam, no sales sequence.

One email per new post. Unsubscribe with one click.

Run your Odoo like this

CICDoo deploys, backs up, monitors and upgrades Odoo from your Git branches, on servers you own. Talk to an engineer about your setup.

No per-seat fees. Your servers stay yours.