Skip to content
Snippets Groups Projects
Commit 370f53d8 authored by Mohammed Shekha's avatar Mohammed Shekha Committed by Aaron Bohy
Browse files

[IMP] web: conditional create/delete options on x2many fields


After this commit, x2many fields can have options like
create/delete which accept a domain, to make create/delete on
x2many conditional, say for example x2many field can have options
like:

options="{'create:' [('foo', '=', True)]', 'delete:' [('foo', '=', True)]'}"

With this when foo field is True, Create and Delete actions will
be available, but if foo is False then they won't.

In case of one2many fields, if 'create' is false, then 'Add a line'
(list) or 'Add' button (kanban) won't be displayed.

In case of many2many fields, 'Add a line' or 'Add' button will
always be displayed even if 'create' condition is false as it
doesn't really create records (but rather links existing ones).
Same applies for delete.

Task-2092953

closes odoo/odoo#42919

Signed-off-by: default avatarAaron Bohy (aab) <aab@odoo.com>
Co-authored-by: default avatarParth Chokshi <pch@odoo.com>
Co-authored-by: default avatarAaron <Bohy&lt;aab@odoo.com>
parent a5c4855a
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment