From 41e08479c8efc9490bc4b864d7b008d97be40480 Mon Sep 17 00:00:00 2001 From: Rithwik Date: Sun, 18 Jun 2023 20:37:42 +0000 Subject: [PATCH] [FIX] website: implements contains for hidden_condition_no_text_opt Multiple field visibility was not working properly while using Multiple Checkbox field as visibility condition. Only "is equal to" and "is not equal to" was implemented for Multiple Checkbox. The "is equal to" uses formData.get which only retrieves the first value from Multiple Checkbox. The Multiple Checkbox was not having "contains" option which was already available for some other fields. This commit will implement "contains" for all the input types which comes under hidden_condition_no_text_opt in the file s_website_form.xml. These include radio, checkbox and Multiple Checkbox. The fields which comes under hidden_condition_no_text_opt which does not require multiple inputs can use "contains" and "doesn't contain" interchangeably with "is equal to" and "is not equal to" Fixes #120631 closes odoo/odoo#129853 X-original-commit: 696d74e5304bd48e965a1c5f5fc0b5a5205f5d49 Signed-off-by: Romain Derie (rde) --- .../website/static/src/snippets/s_website_form/000.js | 4 +++- addons/website/views/snippets/s_website_form.xml | 2 ++ doc/cla/individual/R55555.md | 11 +++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 doc/cla/individual/R55555.md diff --git a/addons/website/static/src/snippets/s_website_form/000.js b/addons/website/static/src/snippets/s_website_form/000.js index 3d1ba043acb..5f73f8e0590 100644 --- a/addons/website/static/src/snippets/s_website_form/000.js +++ b/addons/website/static/src/snippets/s_website_form/000.js @@ -757,7 +757,9 @@ } const formData = new FormData(this.el); - const currentValueOfDependency = formData.get(dependencyName); + const currentValueOfDependency = ["contains", "!contains"].includes(comparator) + ? formData.getAll(dependencyName).join() + : formData.get(dependencyName); return this._compareTo(comparator, currentValueOfDependency, visibilityCondition, between); }; }, diff --git a/addons/website/views/snippets/s_website_form.xml b/addons/website/views/snippets/s_website_form.xml index 46c4b93f3fe..90dce371183 100644 --- a/addons/website/views/snippets/s_website_form.xml +++ b/addons/website/views/snippets/s_website_form.xml @@ -171,6 +171,8 @@ Is equal to Is not equal to + Contains + Doesn't contain diff --git a/doc/cla/individual/R55555.md b/doc/cla/individual/R55555.md new file mode 100644 index 00000000000..c0f5a1e3be0 --- /dev/null +++ b/doc/cla/individual/R55555.md @@ -0,0 +1,11 @@ +India, 2023-06-07 + +I hereby agree to the terms of the Odoo Individual Contributor License +Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this +declaration. + +Signed, + +Rithwik Pradeep rithwikpradeep999@gmail.com https://github.com/R55555