x2many Selectable
Multi-select rows for batch actions — and bulk-add records through a multi-select "Search More" — on any embedded one2many / many2many list.
OPL-1 · Odoo 13
What it does
Two independent widgets for embedded one2many /
many2many lists:
(1) x2many_selectable on the list — real first-column
checkboxes (single click, no boolean field) + buttons declared in the
<header> that run on the ticked lines; and
(2) many2one_multi_select on a many2one sub-field —
its Search More dialog becomes a multi-select list, and each ticked
record becomes a new line.
Fully independent. Checkboxes appear only when the list has
<header> buttons; bulk add is a separate widget on the
many2one sub-field. Use either alone, or both on the same list.
Requirements
Python libraries
None.
System
None (pure client-side widget).
Odoo depends
web
Key features
Real row checkboxes
Same first-column checkboxes and "select all" as a top-level list — one click, no boolean field to add.
Batch action buttons
Declare buttons in the list's
<header>; each runs on the ticked lines
(self = selection).
groups & attrs
Buttons honour groups= and
attrs="{'invisible': [('parent.state','=','…')]}" like form buttons.
Auto-save & reload
The form is saved before the action (new lines get real ids); the list reloads and the selection clears afterwards.
Bulk add via Search More
many2one_multi_select on a m2o
sub-field turns its Search More into a multi-select list: the first
pick fills the current line, each other pick becomes a new line.
No duplicates (opt-out)
Records already used as lines are hidden from
the dropdown & Search More. Set
options="{'allow_duplicates': true}" to allow re-picking them.
one2many & many2many
Both widgets work on either field type; pure
client-side, depends only on web — no server code, no libs.
How to use
- Set
widget="x2many_selectable"on the one2many field. - Declare your button(s) inside the list's
<header>. - Write the method on the line model —
selfis the ticked lines.
<field name="line_ids" widget="x2many_selectable">
<tree editable="bottom">
<header>
<button name="action_mark_done" type="object" string="Mark done"
groups="base.group_user"
attrs="{'invisible': [('parent.state','=','done')]}"/>
</header>
<field name="name"/>
</tree>
</field>
# on the LINE model
def action_mark_done(self): # self = the ticked lines
self.write({'done': True})
Bulk add (optional, independent) —
put many2one_multi_select on a m2o sub-field; its Search More
becomes multi-select and each pick adds a line:
<field name="line_ids" widget="x2many_selectable">
<tree editable="bottom">
<field name="product_id" widget="many2one_multi_select"/>
<field name="qty"/>
</tree>
</field>
Screenshots
Tick lines → click the button. A checkbox column appears with "select all"; a batch button shows the count.
The action runs on the selected lines.
Bulk add — "Search More" opens a multi-select list. Tick several records (checkboxes + "select all"); already-used records are hidden.
Each picked record becomes a new line.
Need help?
Questions, bug reports or feature requests are welcome — email us and we'll get back to you.
Support: vuhaiqn90@gmail.com
Please include your Odoo version and a short view snippet if your question is about a specific list.
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Lines of code | 247 |
| Technical Name |
vh_x2many_selectable |
| License | OPL-1 |
| Website | https://apps.odoo.com/apps/modules/browse?author=Uv+Iah |
x2many Selectable — row checkboxes + batch action buttons
Overview
A reusable field widget that turns any embedded one2many or many2many list into a multi-select list — the framework's real first-column checkboxes and "select all" (single click, no boolean field) — and renders batch-action buttons declared right in the list's <header>. The user ticks lines and clicks a button; the method runs on exactly those line records.
One widget (x2many_selectable) with two independent capabilities on both one2many and many2many fields.
Two independent widgets:
- x2many_selectable (on the o2m/m2m field) — row selection + batch actions, active when the list has <header> buttons: real first-column checkboxes + "select all"; each button runs on the ticked lines (self is the selection). Honours groups= and invisible="parent.<field> == ..." like form buttons. The form is auto-saved before the action; the list reloads and the selection clears afterwards.
- many2one_multi_select (on a many2one sub-field) — bulk add via Search More: the field's "Search More…" dialog opens as a multi-select list; each ticked record becomes a new line (comodel/context read from the field). Records already used as lines are hidden; options="{'allow_duplicates': true}" allows re-picking them.
- Fully independent — use either alone or both on the same list.
- Pure client-side; the only dependency is web.
Installation
- Copy vh_x2many_selectable into your Odoo addons path.
- Update the apps list and install VH x2many Selectable. No Python libraries and no server configuration are required.
Usage
Set the widget on the field and declare your button(s) in the list header:
<field name="line_ids" widget="x2many_selectable">
<list editable="bottom">
<header>
<button name="action_mark_done" type="object" string="Mark done"
groups="base.group_user"
invisible="parent.state == 'done'"/>
</header>
<field name="name"/>
</list>
</field>
Write the method on the line model — self is the ticked lines:
def action_mark_done(self): # self = the ticked lines
self.write({'done': True})
For a many2many field the ticked comodel records are passed the same way. The button must be defined on the line/comodel model, since Odoo validates header buttons against it.
For bulk add, put many2one_multi_select on a many2one sub-field; its "Search More…" dialog becomes multi-select and each picked record adds a line:
<field name="line_ids" widget="x2many_selectable">
<list editable="bottom">
<field name="product_id" widget="many2one_multi_select"/>
<field name="qty"/>
</list>
</field>
Support
Questions, bug reports and feature requests: vuhaiqn90@gmail.com (please include your Odoo version).
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module