Skip to main content
iVentureTeam

many2one_reference_integer

Where many2one_reference resolves a reference into a record picker, many2one_reference_integer does the opposite: it shows you the bare database id and nothing else.

September 18, 2026Updated September 18, 20263 min read
Technical namemany2one_reference_integer
Field typesmany2one_reference
Viewsform, list
Moduleweb, present in every Odoo database
Used in core2 uses in Odoo 19, both in odoo/addons/base/views/ir_model_views.xml. Same count in Odoo 20.
VersionsOdoo 19.0, Odoo 20.0
No-code setupNo. There is no Studio entry for this widget.
Alternativesmany2one_reference, integer, reference

What the many2one_reference_integer widget does

This is one of the smallest widgets in Odoo. It subclasses the integer widget and replaces a single getter:

export class Many2OneReferenceIntegerField extends IntegerField {
    get value() {
        const value = this.props.record.data[this.props.name];
        return value ? value.resId : false;
    }
}

A many2one_reference field arrives in the browser as an object carrying a resId and a display name. The standard integer widget would not know what to do with that object. This widget reaches in, takes the id, and hands it to the integer rendering it inherited.

Everything else, including formatting and edit behavior, comes from the integer widget unchanged.

What this means for your team

This is a technical screen widget. It exists so that developers and administrators looking at Odoo's own plumbing, such as the model and field configuration screens, can see the actual database id rather than a friendly label.

If you are considering it for a business-facing form, ask what problem the id solves. Users almost never want a record id. They want the record. The only common legitimate case is a support or integration screen where someone needs to quote an id to a system that does not speak Odoo.

Working examples

Showing the raw id, with no companion field needed:

<field name="res_id" widget="many2one_reference_integer"/>

Compare with the picker version, which does need one:

<field name="res_model" invisible="1"/>
<field name="res_id" widget="many2one_reference"/>

The one advantage it has over many2one_reference

Its sibling many2one_reference throws a hard JavaScript error when the companion model field is absent from the view, because it cannot resolve a relation without it. This widget never resolves a relation at all, so that failure mode does not exist.

That makes it the safe choice in two situations. First, on a generic list of mixed records where adding the model field to the view is impractical. Second, as a diagnostic: if a form is failing with the model_field must be in view error, temporarily swapping in this widget renders the row and lets you see what the underlying data actually holds.

The price is that the user sees 417 where they wanted SO0142. This is a debugging and administration widget, and it reads like one on any screen a non-technical user opens.

Version compatibility

VersionStatusNotes
Odoo 19.0VerifiedVerified against the shipped 19.0 source.
Odoo 20.0VerifiedVerified against the 20.0 branch. No changes.

Unchanged between the two branches we checked, including its usage count.

What is changing in Odoo 20

No change. The registration is identical on the 20.0 branch: same component shape, same supported type, still no options. It is still used exactly twice, in the same file.

Common problems and fixes

SymptomCause and fix
The field shows a number where users expect a record nameWorking as designed. This widget deliberately shows the raw id. Switch to many2one_reference and add the companion model field to the view.
The field shows false or nothingThe reference is unset, so the getter returns false. Expected for an empty reference. Check the stored value if you believe it should be populated.
Integer widget options such as digits appear to be ignoredThis widget defines its own descriptor rather than spreading the integer one, so it does not inherit integer's declared options. Do not rely on integer options here. If you need formatting, the value is a record id and probably should not be formatted at all.

Many2one_reference_integer widget vs the alternatives

WidgetBest forKey difference
many2one_reference_integerTechnical screens where the database id is the pointShows the numeric id and never resolves the record name
many2one_referenceLetting users pick and read the actual recordResolves the name, but requires a companion model field in the view
integerAn ordinary integer fieldCannot read the object shape a reference field arrives in
referenceA pointer stored as model and id in one columnDifferent field type entirely

In almost every case where someone reaches for this, they actually want many2one_reference and a companion model field. Keep this one for technical screens and for diagnosing a reference field that is not behaving.

Frequently asked questions

How do I show a record's database ID in an Odoo view?+
For a many2one_reference field, use widget="many2one_reference_integer". It reads resId off the value and renders it through the standard integer widget.
Does many2one_reference_integer need the model field in the view?+
No. Unlike many2one_reference, it never resolves the target model, so it cannot throw the model_field must be in view error. That makes it useful for diagnosing a reference field that is breaking a form.
Does it have options?+
No. Its descriptor declares only a component, a display name and supported types. It also does not inherit the integer widget's options, because it builds a fresh descriptor rather than spreading integer's.

Technical screens your admins actually need?

Record ids, model configuration, reference plumbing: the screens that keep an Odoo database maintainable rarely come with the product. We build the admin and support views your team needs, without exposing them to everyone else.

Book a free consultation

How this page was produced

Verified by reading addons/web/static/src/views/fields/many2one_reference_integer/many2one_reference_integer_field.js on the 19.0 branch of a local clone of the official Odoo repository. The value getter is quoted in full above, which is most of the widget. The registration was diffed against the 20.0 branch. Usage counts come from scanning every XML file in Community, Enterprise and odoo/addons/base in both branches. Corrections welcome via our contact page.