Product analytics for the Odoo 19 backend, powered by PostHog.
Odoo Self Learning is a lightweight asset module that injects PostHog into
web.assets_backend so you can see where users get stuck: which screens they
open, where they drop off, which flows are slow. On the server it reports
errors by type and stack, never their text. No personal data leaves Odoo.
- Dormant until connected. Nothing is sent until an administrator presses Connect to Pantalytics in Settings. The PostHog project key and host arrive in a signed entitlement from Pantalytics; no key is typed, shipped or stored in a data file. Disconnect (in Odoo or in the Pantalytics panel) and the module goes quiet at its next daily check-in.
- Pseudonymous identity. Users are identified as
db#uid(database name + user id). Never a name, never an email. - Per-customer workspace. Every database reports under its own PostHog group, keyed by the database uuid Pantalytics knows it by, so data never mixes between customers.
- Privacy first. All input text is masked, autocapture ignores element values, and session replay can be switched off per instance.
- Server errors. Tracebacks, failed scheduled actions and other
ERRORlog lines go to PostHog error tracking as the exception type, the stack (module, function, file, line) and the log message's format string. Never the error text, the message's values or local variables. Same project andworkspacegroup as the browser events.
- Copy the
pan_self_learningfolder into your Odoo addons path. - Update the apps list and install Odoo Self Learning.
- Go to Settings, Odoo Self Learning and press Connect to Pantalytics. A tab opens on the Pantalytics panel with the code filled in. Sign in, check that the page names this Odoo, press Approve, then come back.
That is the whole setup. The module needs the cryptography and requests
Python packages, both of which ship with Odoo.
Privacy switches on the same settings page, stored as system parameters:
| Parameter | Default | Meaning |
|---|---|---|
pan_self_learning.enabled |
True |
Master switch. Off keeps the module dormant even when connected. |
pan_self_learning.mask_all_text |
False |
Also mask all visible text in recordings. |
pan_self_learning.disable_session_recording |
False |
Turn session replay off for this instance. |
pan_self_learning.server_errors |
True |
Report server errors (type and stack only). |
For a staging server, two environment variables override where the module
talks to and which signature it trusts: PAN_SELF_LEARNING_SERVER_URL and
PAN_SELF_LEARNING_PUBLIC_KEY. Never a settings field.
Connecting is the device flow Mail Pro uses: Odoo asks the Pantalytics server
for a pairing code, the administrator approves it in their browser, and Odoo
collects an installation key. Once a day the module sends a heartbeat (the
database uuid and two version strings, nothing else) and gets back a signed
entitlement: the PostHog project key and host, whether sessions may be
recorded, and whether server errors may be reported. The entitlement is only stored when its Ed25519 signature checks
out against the public key shipped in models/pan_self_learning_link.py and
its db_uuid matches this database.
On every backend page load, ir.http.session_info adds a pan_self_learning
block to the session (key, host, pseudonymous distinct_id, workspace,
privacy flags) read from that entitlement. The backend asset
posthog_loader.js reads it and, only when a key is present, bootstraps
PostHog, identifies the pseudonymous user, and assigns the database as a
workspace group.
The server side lives in pantalytics/odoo-mcp-pro-admin
(mcp_server_odoo_admin/apps/self_learning.py).
Server errors: a logging handler on the root logger puts every ERROR
record logged inside a database on a bounded queue. One background thread per
process reads that database's entitlement through its own cursor, sends at
most one event per error kind per minute to <host>/i/v0/e/, and drops
anything it cannot send. Errors logged outside a database (server start, the
database manager) are not reported. The code is server_errors.py.
- The loader fetches
array.jsfrom the PostHog host named in the entitlement. If your backend runs under a strict Content-Security-Policy, allow that host inscript-src/connect-src. - Upgrading from 19.0.1.x removes the pre-filled project key; press Connect to Pantalytics once to resume.
- License: LGPL-3.