From 370f53d8dcc88b4c6960fc321199df688d1d0810 Mon Sep 17 00:00:00 2001 From: Mohammed Shekha Date: Thu, 19 Dec 2019 05:14:01 +0000 Subject: [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: Aaron Bohy (aab) Co-authored-by: Parth Chokshi Co-authored-by: Aaron Bohy --- doc/reference/javascript_reference.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'doc/reference') diff --git a/doc/reference/javascript_reference.rst b/doc/reference/javascript_reference.rst index 912c4db25da..f0db5cd40b2 100644 --- a/doc/reference/javascript_reference.rst +++ b/doc/reference/javascript_reference.rst @@ -2137,6 +2137,12 @@ Relational fields Options: + - create: domain determining whether or not new tags can be created (default: True). + + .. code-block:: xml + + + - color_field: the name of a numeric field, which should be present in the view. A color will be chosen depending on its value. @@ -2176,6 +2182,14 @@ Relational fields Options: + - create: domain determining whether or not related records can be created (default: True). + + - delete: domain determining whether or not related records can be deleted (default: True). + + .. code-block:: xml + + + - create_text: a string that is used to customize the 'Add' label/text. .. code-block:: xml -- cgit v1.2.3