x2_many_image
The image tile in Odoo's product media kanban is not the plain image widget. x2_many_image swaps the file picker for the media dialog, and quietly disables three inherited options while doing it.
| Technical name | x2_many_image |
|---|---|
| Field types | binary, many2one (inherited from the image widget) |
| Views | kanban, list, form, always inside an x2many subview |
| Module | html_editor, installed with Website, Sales and any app that ships the editor |
| Used in core | 1 occurrence, the product media kanban in website_sale |
| Versions | Odoo 20.0, Odoo 19.0, Odoo 18.0 |
| No-code setup | No. This widget is set in view XML and only behaves correctly inside an x2many subview |
| Alternatives | image, x2_many_media_viewer, video_preview, many2many_binary |
What the x2_many_image field does
What this means for your team
Supported options in Odoo 19
| Option | Type | What it does |
|---|---|---|
size | list | Two-element list controlling the rendered width and height, for example [0, 180]. Works normally, because it acts on the image element the widget keeps. |
img_class | string | CSS classes applied to the image element. Undocumented on the base image widget too: read in extractProps but never declared in supportedOptions. Works here. |
preview_image | field | Renders a smaller companion binary field instead of the main one, useful when the full-size field is heavy. Works here. |
zoom | boolean | Shows the enlarged image in a tooltip on hover. Works here. |
zoom_delay | number | Milliseconds before the zoom tooltip appears. Only meaningful together with zoom. Works here. |
reload | boolean | Adds the record's write date to the image URL so the browser refetches after a change. Works here.(default: true) |
accepted_file_extensions | string | <strong>Inert in this widget.</strong> It only configures the file uploader, and the widget's template replaces the block that contains it. |
convert_to_webp | boolean | <strong>Inert in this widget.</strong> It is only read inside the uploader's callback, which the replaced template makes unreachable. |
Two inherited options are dead here. The widget's template replaces the block that holds the file uploader, and both accepted_file_extensions and convert_to_webp are only consumed by that uploader. Set them and nothing happens, with no warning. If you need WebP conversion on product media, it has to come from the media dialog side or from a server-side rule, not from this widget.
Working examples
What the replaced template silently disables
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | In development | Not released. The development branch adds two options and reworks both save paths; see below. |
| Odoo 19.0 | Verified | Verified against the shipped source. File moved to html_editor/static/src/fields/x2many_field/ and the media dialog is limited to Images and Videos. |
| Odoo 18.0 | Verified | First version. Lived at html_editor/static/src/others/ and opened the media dialog with noIcons instead of a tab whitelist. |
| Odoo 17.0 | Not available | Widget does not exist. The html_editor module was introduced in Odoo 18. |
| Odoo 16.0 | Not available | Widget does not exist. |
Upgrade note. The widget arrived in Odoo 18 with the html_editor module and lived at html_editor/static/src/others/; in Odoo 19 the file moved to html_editor/static/src/fields/x2many_field/. The registered name never changed, so view XML needs no edit. The one behavior change between 18 and 19 is the media dialog scope: 18 passed noIcons: true and left the document tab reachable, 19 restricts the dialog to Images and Videos.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| Picking a video does nothing | The subview does not load a field called video_url. Add <field name="video_url" invisible="1"/> to the subview. The widget writes that field by name. |
| The record name keeps changing by itself | Expected behavior. An image save also writes the attachment's file name into the record's name field. Rename after picking the image, or accept the attachment name as the media label. |
| Warning: cannot add URL type attachment | The chosen attachment is a URL record with no stored binary, typically a demo image. Re-upload the file so a real attachment exists, then pick it again. |
| accepted_file_extensions is ignored | The widget's template removes the file uploader that reads that option. Filter at the media dialog or server side instead; the option cannot work here. |
| The delete button removed the whole gallery entry | Expected behavior. Unlike the image widget, this one deletes the child record from the parent relation. Discard the form to recover, and brief users that the trash icon removes the media item. |
| Edit and delete buttons appear on a read-only form | The replaced template drops the base widget's readonly guard. Hide the field itself with an invisible expression when the record must not be edited. |
| An empty tile has no buttons | Both buttons render only when the field already holds a value. Create media rows through the subview's add action rather than expecting users to click an empty tile. |
X2_many_image field vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
x2_many_image | Media galleries where each child record is one image or one video link | Edits through Odoo's media dialog, and deleting removes the child record rather than clearing the image |
| image | A single picture stored on the record itself | Uploads from the file picker and its clear button blanks the field instead of deleting a row |
| x2_many_media_viewer | Adding several media items at once into a relation | Multi-select media dialog that creates many child records in one pass |
video_preview | Showing the embedded player for a stored video | Read-only preview of server-computed embed code, no picking involved |
| many2many_binary | A plain list of attached files | File list with an upload button, no image rendering and no media dialog |
Frequently asked questions
Can I use x2_many_image on a normal form field?+
Which video platforms are accepted?+
Why does my custom media model not save?+
Does convert_to_webp work here?+
Is the widget available in Odoo 17?+
Want a product catalog your team actually maintains?
Media galleries, video-enabled product pages and clean catalog data are where most Odoo eCommerce projects lose momentum. We build and tune the product side of Odoo 16 through 19, including custom media models that behave correctly with widgets like this one.
Book a free consultation