Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Property Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
      • Get a Tailored Demo
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +32 2 290 34 90
    • Get a Tailored Demo
  • Pricing
  • Help
  1. APPS
  2. Productivity
  3. BambooForge Activity Menu Performance: Fix the Slow / 504 Systray v 16.0
  4. Sales Conditions FAQ

BambooForge Activity Menu Performance: Fix the Slow / 504 Systray

by BambooForge Labs
Odoo

$ 113.10

v 16.0 Third Party
Apps purchases are linked to your Odoo account, please sign in or sign up first.
You bought this module and need support? Click here!
  • Description
  • Manifest
  • Documentation
  • License
BambooForge Activity Menu Performance
BambooForge Activity Menu Performance by BambooForge Labs · Large-database performance
Odoo 16.0 License OPL-1 No Enterprise required
Activity Menu Performance for Odoo 16
No upgrade required Same badge numbers Fixes 504 timeouts Multi-company safe Zero configuration Uninstall-clean
The problem

One clock icon can take down an instance

The activity systray (the clock in the top bar) loads on every page. Standard Odoo 16 pulls all of the current user’s scheduled activities into memory and filters them with an O(n²) membership test. When an automated rule has quietly piled hundreds of thousands of activities onto one user — a common failure mode on aged databases — that user’s activity menu takes minutes, pins a worker and returns 504 Gateway Timeout, degrading the whole instance.

Activity menu load: 600s+ timeout to under 1 second
<1sactivity menu load, down from 600 s+
514kactivities on one user, handled in SQL
100%identical badge numbers & permissions
0schema changes or configuration
How it works

One fast query instead of the whole table

Grouped SQL aggregate

The overdue / today / planned badges are computed with a single indexed COUNT(*) FILTER per model. The activity table never enters Python.

Record rules, in SQL

Each model’s record rules are compiled and pushed into the query’s WHERE clause, so the badge counts only what the user may read — multi-company included.

Identical result shape

The returned data structure — keys, per-model dictionaries, the actions entry — is identical to standard Odoo, so the menu renders exactly as before.

Are you affected?

Check in ten seconds

Run this read-only query. If any single user has tens or hundreds of thousands of activities on one model, that menu is the bottleneck this module fixes.

-- top activity owners
SELECT u.login, a.res_model, count(*)
FROM mail_activity a JOIN res_users u ON u.id = a.user_id
GROUP BY u.login, a.res_model
ORDER BY count(*) DESC LIMIT 10;

Who it’s for

Any Odoo 16 database that has accumulated a large mail.activity table — typically from long-running automated actions — and whose activity menu has become slow or throws 504 timeouts for some users.

Questions, answered

Will my badge numbers change?

No. Permissions, buckets and result shape are all preserved; the automated tests assert exact parity with standard Odoo.

Is it safe on multi-company databases?

Yes. The multi-company record rule is compiled into the SQL, so counts are correct per company.

Should I still clean up the activities?

Yes — investigate the automated action that created them. This module makes the menu fast regardless, but a runaway rule will keep growing the table.

What happens on uninstall?

Standard behaviour returns. There is no schema change to reverse.

BambooForge Labs · bambooforge.labs@gmail.com
Odoo 16.0 · License OPL-1 · No Enterprise modules required
Documentation-first — the built-in manual (this page & doc/index.rst) covers install, verification and troubleshooting, so you can run it without a support subscription.
Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies Discuss (mail)
Lines of code 52
Technical Name bambooforge_activity_perf
LicenseOPL-1

BambooForge Activity Menu Performance

The clock icon in the top bar loads on every page and, on databases with a very large mail.activity table, it can take minutes or return 504 Gateway Timeout for the affected users. This module replaces the counting logic with a single fast SQL query per model that returns the exact same badge numbers — no upgrade, no data migration, no configuration.

This page is the complete manual. Read it top to bottom and you can install, verify the fix and understand exactly what changed without contacting support.

  • The problem
  • What this module does
  • Why the numbers stay identical
  • Installation
  • Verifying the fix
  • Frequently asked questions
  • Support

The problem

The activity systray (the clock in the top bar) calls res.users.systray_get_activities on every page load. Standard Odoo 16:

  1. search() all of the current user's scheduled activities into memory;
  2. builds a dictionary keyed by each activity's record;
  3. filters the records the user may see with record not in allowed_records — an O(n²) membership test on a recordset.

For most users this is instant. But a common failure mode on aged databases is an automated action or server action that has quietly created activities on records that never close — piling hundreds of thousands of activities onto a single user. On a real production database one user had 514,789 activities on Manufacturing Orders. For that user the activity menu materialised the whole set in Python on every page load, took 600+ seconds, pinned a worker process and returned a 504 timeout — degrading the whole instance.

Upgrading Odoo is not a fix you can schedule around a live timeout, and it does not address the accumulated data. This module fixes the algorithm in place.

What this module does

It overrides res.users.systray_get_activities to count the badges with one grouped SQL query per model instead of loading the activity table into Python:

  • COUNT(*) FILTER (...) computes the overdue / today / planned buckets in a single indexed aggregate;
  • each model's record rules are compiled to SQL (via _apply_ir_rules) and pushed into the WHERE clause, so the badge counts only the activities on records the user is actually allowed to read;
  • a model-level check_access_rights gate skips models the user cannot read.

The returned data structure is identical to standard Odoo — same keys, same per-model dictionaries, including the actions entry the systray JavaScript expects — so the menu renders exactly as before, just instantly.

Why the numbers stay identical

This is a performance change, not a behaviour change:

  • Same permissions. Record rules and model access are applied in SQL exactly as the standard membership test applied them. A user who cannot read a model still sees zero for it; records hidden by a record rule (for example the multi-company rule) are not counted.
  • Same buckets. Overdue / today / planned are computed from date_deadline against the user's today, the same classification the standard menu uses.
  • Same shape. The result is the same list of per-model dictionaries with the same keys.

The bundled automated tests assert this directly: exact per-bucket counts on a mixed dataset, correct filtering through the standard multi-company record rule, and no entry for models with no activities.

Installation

  1. Copy bambooforge_activity_perf into your addons path.
  2. Update the apps list and install BambooForge Activity Menu Performance.
  3. There is nothing to configure. The override is active immediately.

Dependencies: mail (standard). No Enterprise modules are needed. There is no schema change and no new stored column, so the module is uninstall-clean.

Verifying the fix

Before installing, you can confirm whether you are affected. Run (read-only):

SELECT u.login, a.res_model, count(*)
FROM mail_activity a JOIN res_users u ON u.id = a.user_id
GROUP BY u.login, a.res_model
ORDER BY count(*) DESC
LIMIT 10;

If any single user has tens or hundreds of thousands of activities on one model, that user's activity menu is the bottleneck this module fixes. After installing, open that user's session — the clock menu opens immediately, with the same badge numbers.

You should also investigate why those activities were created (usually an automated action) and clean up the stale ones; this module makes the menu fast regardless, but a runaway rule will keep growing the table.

Frequently asked questions

Will my badge numbers change?
No. See Why the numbers stay identical — permissions, buckets and shape are all preserved.
Is it safe on multi-company databases?
Yes. The multi-company record rule is compiled into the SQL, so counts are correct per company, exactly as before.
Do I need to upgrade Odoo or delete data?
No. The module is an in-place algorithmic fix. Cleaning up the source of the activity pile-up is recommended but independent of this module.
What happens on uninstall?
The override is removed and standard behaviour returns. There is no schema change to reverse.

Support

BambooForge Labs — bambooforge.labs@gmail.com

Odoo Proprietary License v1.0

This software and associated files (the "Software") may only be used (executed,
modified, executed after modifications) if you have purchased a valid license
from the authors, typically via Odoo Apps, or if you have received a written
agreement from the authors of the Software (see the COPYRIGHT file).

You may develop Odoo modules that use the Software as a library (typically
by depending on it, importing it and using its resources), but without copying
any source code or material from the Software. You may distribute those
modules under the license of your choice, provided that this license is
compatible with the terms of the Odoo Proprietary License (For example:
LGPL, MIT, or proprietary licenses similar to this one).

It is forbidden to publish, distribute, sublicense, or sell copies of the Software
or modified copies of the Software.

The above copyright notice and this permission notice must be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author or have a question related to your purchase, please use the support page.
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with