Skip to main content
iVentureTeam

many2one_avatar_leader_user

A user picker that knows who runs the team: many2one_avatar_leader_user renders the standard avatar dropdown and marks the selected sales team's leader with a (Team Leader) tag.

Siddharth JambukiyaSiddharth JambukiyaOdoo Techno-Functional Consultant
August 24, 2026Updated August 24, 20266 min read
Technical namemany2one_avatar_leader_user
Field typesmany2one (res.users)
Viewsform, list
Modulecrm (CRM app)
Used in core3 occurrences across crm and event_crm
VersionsOdoo 20.0, Odoo 19.0
No-code setupNo. XML only; Studio does not expose it
Alternativesmany2one_avatar_user, many2one_avatar_employee, many2one

What the leader picker widget does

When you assign a salesperson in a context that already knows the sales team, the fair question is: which of these users actually leads that team? many2one_avatar_leader_user answers it inside the dropdown. It is a small CRM-module subclass of many2one_avatar_user, so you get the familiar avatar chip and user search, plus one addition: the entry belonging to the selected team's leader carries a (Team Leader) tag.

The mechanism, read from the 19.0 source, is a context handshake. The widget takes a teamField attribute naming the team many2one on the same record, reads that team's id, and injects it as crm_formatted_display_name_team into the dropdown's search context. Server side, res.users checks the context, looks up the team's user_id, and appends the marker to that one user's display name using Odoo 19's formatted display name convention, which the dropdown renders as a muted suffix.

Core wires it up where lead routing is configured: the team member settings in CRM and the lead generation rules of event_crm, always next to a team field like lead_sales_team_id.

What this means for your team

Lead routing screens are where a wrong click quietly reshapes a sales org: assign event leads to the wrong person and a team leader spends the quarter wondering where their pipeline went. The widget's job is context at the moment of choice. Whoever configures the rule sees, without leaving the dropdown, which candidate is the leader of the team the rule feeds, and can deliberately pick the leader for oversight or a member for workload.

It also encodes a data dependency worth respecting in customizations: the marker follows the team currently selected on the record. Change the team, reopen the user dropdown, and the tag moves to the new team's leader. That live link between two fields on the same form is exactly what generic user pickers cannot express, and replicating it by hand, with domains and onchanges, is clumsier than reusing this widget next to your own team field.

If your org chart concept is departments rather than sales teams, this widget does not transfer, the server hook is CRM-specific, but the pattern, a ten-line widget passing one context key to a display name override, is a template our team reuses for approver and manager pickers.

Supported options in Odoo 19

Read from many2one_avatar_leader_user.js on the Odoo 19.0 branch: the descriptor spreads many2OneAvatarUserField and adds a single extracted attribute. Everything else, including the avatar rendering and the base avatar user options, is inherited unchanged.

OptionTypeWhat it does
teamFieldattribute (camelCase)Required. Names the many2one field on the same record holding the crm.team whose leader should be tagged in the dropdown. Written as an XML attribute, not an option.(since Odoo 19.0)
no_openbooleanInherited from the many2one family. Disables navigating to the user record from the chip.
no_createbooleanInherited from the many2one family. Removes user creation from the dropdown, usually desirable for user fields.

teamField is an attribute and it is mandatory. It is declared as a required prop, so the widget without the attribute does not degrade to a plain avatar picker, it fails OWL props validation. It is also camelCase XML, written directly on the field element, not inside options="{}". The getter reads the team id off the record without an empty-value guard, so keep the widget next to a team field that is required or defaulted.

Working examples

The core pattern, from event lead rules

<field name="lead_sales_team_id"/>
<field name="lead_user_id" widget="many2one_avatar_leader_user"
       teamField="lead_sales_team_id"/>

With inherited avatar-user options

<field name="user_id" widget="many2one_avatar_leader_user"
       teamField="team_id"
       options="{'no_open': True, 'no_create': True}"/>

Both options come from the inherited many2one behavior; the leader tag needs no configuration beyond teamField.

How the Team Leader tag is decided

The server half is three lines in crm/models/res_users.py and repays reading. The display name override fires only when two context keys are present: crm_formatted_display_name_team, injected by this widget, and formatted_display_name, which Odoo's autocomplete sets when it wants rich name formatting. It then browses the team, takes its user_id, and appends the marker to exactly that user, wrapped in the --...-- convention that the dropdown renders as muted text.

Three consequences follow. First, the tag appears in dropdown listings but never in the stored value, exports or the readonly chip, because those render without the formatting context. Second, only one user per team can carry the tag, the team's user_id; co-leadership setups will show a single leader. Third, the lookup runs per dropdown search, so the tag always reflects the current team on the record, not the team at form load.

On the client side, the notable line is the unguarded read: record.data[teamField].id. With an empty team the widget has nothing to inject and the expression errors instead of skipping, which is why every core usage sits next to a team field that always has a value. Treat that as a placement rule when you reuse the widget.

Version compatibility

VersionStatusNotes
Odoo 20.0In developmentNot released. Props migration only on the development branch; behavior identical. See below.
Odoo 19.0VerifiedIntroduced in 19.0; verified against the shipped source and the res.users override.
Odoo 18.0Not availableDoes not exist; use many2one_avatar_user.
Odoo 17.0Not availableDoes not exist.
Odoo 16.0Not availableDoes not exist.

Upgrade note. New in Odoo 19; earlier versions have no equivalent and the plain many2one_avatar_user is the fallback when backporting views.

What is changing in Odoo 20

Odoo 20 is expected at Odoo Experience in Brussels, 24 to 26 September 2026. The notes below are read from the public development branch, which can still change before release; we re-verify against the shipped version.

No functional changes are visible on master. The diff is the framework-wide props migration: useProps with the shared avatar-user props and t.string() for teamField, replacing the static declarations. Registration name, context key and server override are untouched.

Inherited changes are the ones to watch: the base avatar user widget is picking up the master-branch avatar cache-busting and card changes tracked on its own page, and whatever lands there flows through this descriptor automatically. Plan the review together during an Odoo 20 upgrade.

Common problems and fixes

SymptomCause and fix
View crashes with a props validation errorThe teamField attribute is missing; it is a required prop. Add teamField="your_team_field" to the field element.
No Team Leader tag on anyone in the dropdownThe selected team has no user_id set as leader, or the team field is pointing at a different record than expected. Set the leader on the crm.team record and check the teamField name.
Widget errors when the team field is emptyThe component reads the team id without an empty guard. Make the team field required or defaulted wherever this widget is used.
Tag shows in the dropdown but not on the selected valueThe marker is appended only under the dropdown's formatted-name context. Expected behavior; the stored name stays clean by design.
Tag does not update after changing the teamIt does, but only on the next dropdown search, which re-reads the team id. Reopen the dropdown after switching teams.

Leader picker widget vs the alternatives

WidgetBest forKey difference
many2one_avatar_leader_userUser pickers on records that carry a sales teamTags the team's leader inside the dropdown via a context handshake
many2one_avatar_userGeneral user assignment fieldsSame avatar chip without the leader logic or the team dependency
many2one_avatar_employeeEmployee rather than user referencesTargets hr.employee and switches relation by HR access
many2onePlain relational fieldsNo avatar, no extra behavior, lightest option

Reach for this widget only when the record carries both a team and a user field; without a team to interrogate, the leader tag has no meaning and the base avatar widgets do everything else.

Frequently asked questions

What does many2one_avatar_leader_user add over many2one_avatar_user?+
One behavior: it reads the sales team from the field named in teamField and asks the server to tag that team's leader with (Team Leader) in the user dropdown. Rendering, options and everything else come from the base avatar user widget.
How does Odoo know who the team leader is?+
The widget passes the team id in the crm_formatted_display_name_team context key, and a res.users override in the crm module appends the marker to the user matching that team's user_id. One user per team, resolved at search time.
Why is teamField an attribute instead of an option?+
It is declared as a component prop extracted from the XML attribute, the same pattern as iconField on the activity badge widget. Write it directly on the field element in camelCase; putting it inside options="{}" does nothing and the missing prop then breaks the view.
Is the Team Leader text stored anywhere?+
No. It is display formatting applied to the dropdown listing only, using Odoo 19's formatted display name convention. The stored many2one value, exports and the selected chip show the plain user name.
Can I use the widget outside CRM?+
Only where a crm.team field exists on the record, because the server hook lives in the crm module and reads the team's leader. For non-CRM leader concepts you would replicate the pattern: a subclass injecting a context key plus a display name override.
Does it change in Odoo 20?+
The development branch shows only the props-system migration with identical behavior; changes to the underlying avatar user widget flow through automatically. Nothing is final until the September 2026 release, and this page will be re-verified then.

Lead routing that lands on the right desk

We design CRM assignment flows where teams, leaders and round-robin rules are visible at the moment of configuration, not discovered after a quarter of misrouted leads. Custom pickers like this one are small builds with outsized effect on pipeline hygiene.

Review my lead assignment setup

How this page was produced

Verified by reading many2one_avatar_leader_user.js on the Odoo 19.0 and development branches and the res.users display name override in crm/models/res_users.py, confirming the context key, the team user_id lookup and the marker convention. The required-prop behavior and the unguarded record read are taken from the component source. Core usage was checked in the crm and event_crm view archs. Corrections welcome via our contact page.