Filter based on authenticated user
Make your questions dynamic by filtering data based on the currently logged-in user.
Overview
In O'Dashboard, you can add filters based on the currently logged-in user when creating a question. This allows you to build charts and indicators that are personal to each user — their own tasks, their own sales figures, and more.
In Builder mode
Let's say you have a question showing the total number of confirmed sales orders. To make it personal, you need to add a filter so that this metric only reflects the sales of the currently logged-in user.
- Click + Field in the filter section
- Search for Salesperson
- Click the + button next to the field to add it directly as a filter (without navigating into its related model)
Relational field types
In Odoo, relational fields don't always point to res.users — they can point to a contact or an employee record instead. Always check which model the field is linked to, as this determines which dynamic value to use.
In the filter configuration, scroll down through the available options. At the bottom, you'll find a special set of dynamic values — you can filter based on:
- Connected user — for fields linked to
res.users - Contact — for fields linked to
res.partner - Employee — for fields linked to
hr.employee
Since the Salesperson field is linked to res.users, select In my user.
Instant result
The result updates immediately — for example, dropping from 15 to 4 confirmed sales orders, showing only the current user's data.
In SQL mode
You can achieve the same result in SQL mode. In the WHERE clause of your query, type the technical field followed by = and then {{.
As you start typing, autocomplete suggestions appear with the available dynamic variables:
- Current Odoo user ID — for
res.usersfields - Current contact ID — for
res.partnerfields - Current employee ID — for
hr.employeefields - Current company ID — for multi-company filtering
For example, to filter sales by the current salesperson:
SELECT state, SUM(amount_total)
FROM sale_order
WHERE state = 'sale'
AND user_id = {{current_odoo_user_id}}
GROUP BY stateSame result, two approaches
Whether you prefer the visual builder or SQL, O'Dashboard gives you full control over who sees what.