Skip to main content
iVentureTeam

code_ir_ui_view

code_ir_ui_view is the code editor Odoo puts on the arch field of the Views screen. It is the ace widget with a different editor component bolted on, and it is applied in a way a normal search will never find.

September 18, 2026Updated September 18, 20264 min read
Technical namecode_ir_ui_view
Field typestext, html
Viewsform
Moduleweb, present in every Odoo database
Used in coreApplied once, on the arch field of the View form, via addons/web/views/ir_ui_view_views.xml. It is set with an <attribute name="widget"> in an inherited view rather than a widget attribute.
VersionsOdoo 19.0, Odoo 20.0
No-code setupNo. This is a technical widget on a technical screen.
Alternativescode, html, text

What the code_ir_ui_view widget does

This widget is almost entirely inherited. The source is short enough to read in full:

export class IrUiViewAceField extends AceField {
    static template = "web.IrUIViewAceField";
    static components = { IrUiViewCodeEditor };
}

export const irUiViewAceField = {
    ...aceField,
    component: IrUiViewAceField,
    additionalClasses: ["o_field_ace"],
};

Because the descriptor spreads aceField, it takes on the ace widget's declared option, mode, and its supported types of text and html. What it changes is the editor component, substituting IrUiViewCodeEditor for the generic one, and it adds a styling class.

What this means for your team

This is the editor your technical team sees when they open a view record to inspect or patch an inherited view. It is worth knowing it exists for one reason: it is the screen where a badly formed XML edit takes a database down, and it offers highlighting rather than validation.

If people in your organization edit views through this screen, that is a change nobody can review and nothing records properly. View changes belong in a module, in version control, where they can be reviewed and rolled back. The editor is fine for reading.

Supported options in Odoo 19

One option, inherited from the ace descriptor rather than declared here. Our automated extractor reports zero options for this widget because the inheritance is a spread of an imported object, which a static scan of one file cannot follow. Reading both files shows the real answer.

OptionTypeWhat it does
modestringThe Ace syntax mode, for example xml or python. Inherited from the ace descriptor rather than declared on this widget, so it does not appear in a static scan of this file. Ace's own extractProps reads it as options.mode.

Working examples

The interesting example is how Odoo applies it, because it is not the usual form. In addons/web/views/ir_ui_view_views.xml, an inherited view sets the widget as an attribute:

<attribute name="widget">code_ir_ui_view</attribute>

Applying it yourself, on a text field holding markup, looks ordinary:

<field name="template_source" widget="code_ir_ui_view"
       options="{'mode': 'xml'}"/>

Why searching for this widget finds nothing

We scanned every XML file in Odoo 19 Community and Enterprise for widget="code_ir_ui_view". The count is zero, which would normally mean an unused registration. It is not: the widget is on a screen you can open right now.

The reason is that it is applied through view inheritance. Rather than writing the widget on the field, Odoo patches an existing field in an inherited view:

<attribute name="widget">code_ir_ui_view</attribute>

The rendered view ends up with the widget set; the source XML never contains the string widget="code_ir_ui_view".

Two things follow. First, on this site, when a widget page reports a low or zero usage count, treat it as a count of one specific spelling rather than proof the widget is dead. Second, and more usefully for your own work: if you are hunting for where a widget is applied in a database and a direct search comes up empty, search for the widget name on its own, without the widget= prefix, and you will find the attribute-based applications too.

The same trap catches widgets applied by field type with no attribute at all, such as json and many2one_reference, which Odoo resolves through the registry using the field type as the key.

Version compatibility

VersionStatusNotes
Odoo 19.0VerifiedVerified against the shipped 19.0 source, including the inherited ace descriptor.
Odoo 20.0VerifiedRegistration unchanged. Inherits ace's new lineWrapping option.

Unchanged between the two branches we checked.

What is changing in Odoo 20

No change to the registration. Diffing the 20.0 branch shows the same spread of the ace descriptor, the same component substitution and the same additional class.

The ace widget it inherits from does change in Odoo 20: it gains a lineWrapping option. Since code_ir_ui_view spreads the ace descriptor, that option comes along with it.

Common problems and fixes

SymptomCause and fix
A search for widget="code_ir_ui_view" finds nothingOdoo applies it through an inherited <attribute name="widget"> rather than a widget attribute. Search for the widget name alone, without the widget= prefix.
The mode option appears to be undocumentedIt is inherited from the ace descriptor via a spread, so tooling that scans a single file misses it. Read ace_field.js in the ace folder. mode is declared there and read by ace's extractProps.
The editor does not appear on a non-text fieldThe inherited supportedTypes are text and html only. Check the browser console. Odoo logs a warning on a type mismatch and renders anyway rather than failing.

Code_ir_ui_view widget vs the alternatives

WidgetBest forKey difference
code_ir_ui_viewEditing view architecture on the Views screenThe ace widget with a view-specific editor component and styling class
codeGeneral code editing on a text fieldSame ace descriptor, generic editor component
htmlContent users write, not codeRich text editing rather than raw markup
textPlain multi-line textNo highlighting and no editor component

For an ordinary text field that needs highlighting, use code, which is registered to the same ace descriptor and is the general-purpose choice. Keep code_ir_ui_view for view arch editing, where the specialized editor component is the point.

Frequently asked questions

What is the code_ir_ui_view widget in Odoo?+
It is the syntax-highlighted editor on the arch field of the Views screen. It spreads the ace descriptor and swaps in a view-specific editor component, so it inherits ace's mode option and its text and html supported types.
Why can I not find widget="code_ir_ui_view" in the Odoo source?+
Because Odoo applies it through view inheritance, using <attribute name="widget">code_ir_ui_view</attribute> in addons/web/views/ir_ui_view_views.xml. The literal string widget="code_ir_ui_view" never appears.
Does code_ir_ui_view have options?+
Yes, one: mode, the Ace syntax mode. It is inherited from the ace descriptor by a spread rather than declared on this widget, which is why static scans report zero options for it.
Does it change in Odoo 20?+
The registration is unchanged. Because it spreads the ace descriptor, it picks up ace's new lineWrapping option in Odoo 20.

View edits happening straight in the database?

Editing view arch through the Views screen leaves no review, no history and no way back when a form stops rendering. We move those changes into a proper module with version control, and clean up the ones already applied by hand.

Book a free consultation

How this page was produced

Verified by reading addons/web/static/src/views/fields/ir_ui_view_ace/ace_field.js and the ace descriptor it spreads, addons/web/static/src/views/fields/ace/ace_field.js, both on the 19.0 branch of a local clone of the official Odoo repository. The inherited mode option and the text and html supported types come from that second file. The application path was found by searching for the widget name without the widget= prefix, which located the attribute in addons/web/views/ir_ui_view_views.xml. Both registrations were diffed against the 20.0 branch. Corrections welcome via our contact page.