iframe_wrapper
For HTML that is a whole document rather than a fragment: styles, head metadata, the lot. It writes the value straight into an iframe, and the source explains at length why.
August 27, 2026Updated August 27, 20265 min read
| Technical name | iframe_wrapper |
|---|---|
| Field types | text, html |
| Views | form |
| Module | web, present in every Odoo database |
| Used in core | Used for previewing complete server-generated documents |
| Versions | Odoo 20.0, Odoo 19.0, Odoo 18.0, Odoo 17.0, Odoo 16.0 |
| No-code setup | No. It needs a field holding a full HTML document |
| Alternatives | html, pdf_viewer, text, google_slide_viewer |
What the iframe wrapper field does
What this means for your team
Working examples
Why it writes rather than builds
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | In development | Not released. Behavior unchanged on the development branch. |
| Odoo 19.0 | Verified | Verified against the shipped source. Identical to Odoo 18. |
| Odoo 18.0 | Verified | Identical behavior. |
| Odoo 17.0 | Verified | Same approach with older component conventions. |
| Odoo 16.0 | Verified | Same approach with older component conventions. |
Upgrade note. The widget has been present with this approach since Odoo 16, and the Odoo 18 and Odoo 19 files are identical. There is nothing to migrate in views; what matters on any upgrade is that the field's sanitize configuration still lets the document through.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| Styles and head content are missing | The field sanitizes its HTML, stripping the metadata before the widget renders it. Relax the field's sanitize configuration, which the source comment warns about, or store the document in a text field. |
| The frame is empty | The field holds nothing, or the value is not a document. Check what the server writes into the field. |
| The document does not refresh | It should; the write is keyed on the value. Confirm the field actually changed rather than a related one. |
| The document's styles affect the page | They should not, since the document is inside a frame. Check that the widget is really in use rather than a plain HTML field. |
| It cannot be edited | Intended. The widget is a viewer with no editing path. Use the rich text widget where editing is needed. |
| Options are ignored | The widget declares none and has no extractor. Nothing to configure here. |
Iframe wrapper field vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
iframe_wrapper | Previewing a complete HTML document without its styles leaking | Writes the value into an iframe, refreshing whenever the value changes |
| html | Fragments users edit | An editor, and its content shares the page's styles |
pdf_viewer | Documents that are PDFs | Renders a PDF rather than HTML |
| text | Showing the markup itself | Prints the source rather than rendering it |
google_slide_viewer | Embedding a hosted presentation | Frames an external URL rather than stored markup |
Frequently asked questions
Why does it use document.write?+
Why is my styling missing?+
Can users edit the document?+
Does it refresh when the value changes?+
Is the content sandboxed?+
Previews that show what the customer will actually get
Rendered documents, templated emails and printed layouts diverge from the preview in ways nobody notices until a customer does. We build and verify Odoo document generation on versions 16 through 19.
Book a free consultation