[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) <rde@odoo.com>
This commit is contained in:
@@ -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);
|
||||
};
|
||||
},
|
||||
|
||||
@@ -171,6 +171,8 @@
|
||||
<we-select data-name="hidden_condition_no_text_opt" data-attribute-name="visibilityComparator" data-no-preview="true">
|
||||
<we-button data-select-data-attribute="selected">Is equal to</we-button>
|
||||
<we-button data-select-data-attribute="!selected">Is not equal to</we-button>
|
||||
<we-button data-select-data-attribute="contains">Contains</we-button>
|
||||
<we-button data-select-data-attribute="!contains">Doesn't contain</we-button>
|
||||
</we-select>
|
||||
<we-select data-name="hidden_condition_text_opt" data-attribute-name="visibilityComparator" data-no-preview="true">
|
||||
<!-- str comparator possibilities -->
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user