From bd235e57cc8640b51e1f8e3775f014fbbe4c1229 Mon Sep 17 00:00:00 2001 From: "Thomas Lefebvre (thle)" Date: Wed, 23 Nov 2022 15:05:33 +0000 Subject: [PATCH] [FIX] base, contact: add conditions in Set Defaults form Version: only V16.0 (will be improve in future versions) Steps to reproduce: - install the "contacts" module; - go to a contact; - go to the "Set Defaults" tab (in the debug menu). Issue: There is no field that allows you to select the condition. Cause: The function `getConditions` needs the `change_default` attribute of the field. Solution: Add the `change_default` attribute to the list which is returned by the `_get_view_field_attributes` function. opw-3079328 closes odoo/odoo#106410 X-original-commit: 07315bee24f69e2b9a1004d33eab842a8929709d Signed-off-by: Denis Ledoux (dle) Signed-off-by: Lefebvre Thomas (thle) --- addons/contacts/static/tests/tours/debug_menu_set_defaults.js | 4 ++++ odoo/addons/base/models/ir_ui_view.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/contacts/static/tests/tours/debug_menu_set_defaults.js b/addons/contacts/static/tests/tours/debug_menu_set_defaults.js index 54fec23d36b..1ac7c3c3143 100644 --- a/addons/contacts/static/tests/tours/debug_menu_set_defaults.js +++ b/addons/contacts/static/tests/tours/debug_menu_set_defaults.js @@ -39,6 +39,10 @@ odoo.define('debug_menu_set_defaults.tour', function (require) { element_field.dispatchEvent(new Event("change")); }, }, + { + content: "Check that there are conditions", + trigger: '#formview_default_conditions', + }, { content: "Save the new default", trigger: 'footer button:contains(Save default)', diff --git a/odoo/addons/base/models/ir_ui_view.py b/odoo/addons/base/models/ir_ui_view.py index 5955548ee8d..e8d730453a1 100644 --- a/odoo/addons/base/models/ir_ui_view.py +++ b/odoo/addons/base/models/ir_ui_view.py @@ -2695,8 +2695,8 @@ class Model(models.AbstractModel): :rtype: list """ return [ - 'context', 'currency_field', 'definition_record', 'digits', 'domain', 'group_operator', 'groups', 'help', - 'name', 'readonly', 'related', 'relation', 'relation_field', 'required', 'searchable', 'selection', 'size', + 'change_default', 'context', 'currency_field', 'definition_record', 'digits', 'domain', 'group_operator', 'groups', + 'help', 'name', 'readonly', 'related', 'relation', 'relation_field', 'required', 'searchable', 'selection', 'size', 'sortable', 'store', 'string', 'translate', 'trim', 'type', ]