summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/helpers/test_utils_create.js
diff options
context:
space:
mode:
authorXavier ALT <xal@odoo.com>2020-06-10 23:57:42 +0000
committerXavier ALT <xal@odoo.com>2020-06-25 15:01:29 +0000
commit19033e804ec243c593c9549a3f0024fbf2230ab1 (patch)
tree778c915c3604d3923a0681502f0d14de1b01d2ff /addons/web/static/tests/helpers/test_utils_create.js
parent6162a0fee38b6776567a0a324783cbdce38f0f43 (diff)
[FIX] web: in search view, use modifiers to determine if filter is invisible
In search view, the "invisible" attribute can use complex expression, and so we must rely on the "modifiers" attribute set by the ir.ui.view post-processing to determine if a filter should be invisible or not. For example, considering the context {'hide_myfilter': False}, the following view: ```xml <search> ... <filter name="myfilter" string="My Filter" invisible="context.get('hide_myfilter')"/> ... </search> ``` Will be returned as such by the server: ```xml <search> ... <filter name="myfilter" string="My Filter" invisible="context.get('hide_myfilter')" modifiers="{&quot;invisible&quot;: false}"/> ... </search> ``` After this commit, the filter "myfilter" will correctly be shown. OPW-2243639 closes odoo/odoo#53690 X-original-commit: 00969326e24dadd9b3f6e026789a1e575dd1c8dc Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Signed-off-by: Julien Mougenot (jum) <jum@odoo.com> Signed-off-by: Xavier ALT <xavieralt@users.noreply.github.com>
Diffstat (limited to 'addons/web/static/tests/helpers/test_utils_create.js')
-rw-r--r--addons/web/static/tests/helpers/test_utils_create.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/addons/web/static/tests/helpers/test_utils_create.js b/addons/web/static/tests/helpers/test_utils_create.js
index 341ace4fba8..17debd413d0 100644
--- a/addons/web/static/tests/helpers/test_utils_create.js
+++ b/addons/web/static/tests/helpers/test_utils_create.js
@@ -191,6 +191,25 @@ odoo.define('web.test_utils_create', function (require) {
fields: {},
}, params.cpProps);
+ if (config.viewInfo && config.viewInfo.arch && config.viewInfo.fields) {
+ const { arch, fields } = config.viewInfo;
+ const model = "__mockmodel__";
+ const serverParams = {
+ model,
+ data: { [model]: { fields, records: [] } },
+ };
+ const mockServer = await testUtilsMock.addMockEnvironment(
+ new Widget(),
+ serverParams,
+ );
+ Object.assign(config.viewInfo, testUtilsMock.fieldsViewGet(mockServer, {
+ arch,
+ fields,
+ model,
+ viewOptions: { context: config.actionContext },
+ }));
+ }
+
class Parent extends Component {
constructor() {
super();