From ecb8212f58c046ea3c06638a89341da4aed27a5a Mon Sep 17 00:00:00 2001 From: SilvioC2C Date: Wed, 11 Aug 2021 12:30:52 +0200 Subject: [PATCH 1/6] [FIX] web_m2x_options: fix search_more behaviour In README.rst it is said that ``search_more`` key is "[u]sed to force disable/enable search more button". However, it only applies on fields where the records returned by the name_search are more than the node's limit. This commit fixes this behaviour, forcing the "Search More..." option to be *always* disabled/enabled if ``search_more`` key is set either locally (in the node's options) or globally (via the ir.config_parameter record). Moreover, it establishes a clear line of priority for checking whether "Search More..." should be displayed/hidden (local node has the highest priority, global config mid priority, limit check as fallback). --- web_m2x_options/static/src/js/form.js | 124 ++++++++++++++------------ 1 file changed, 65 insertions(+), 59 deletions(-) diff --git a/web_m2x_options/static/src/js/form.js b/web_m2x_options/static/src/js/form.js index aec8745b5..cfabc0733 100644 --- a/web_m2x_options/static/src/js/form.js +++ b/web_m2x_options/static/src/js/form.js @@ -221,70 +221,76 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) { }); } - // Search more... if more results that max - var can_search_more = - self.nodeOptions && - self.is_option_set(self.nodeOptions.search_more), - search_more_undef = - _.isUndefined(self.nodeOptions.search_more) && - _.isUndefined( - self.ir_options["web_m2x_options.search_more"] - ), - search_more = self.is_option_set( + // Search more... + // Resolution order: + // 1- check if "search_more" is set locally in node's options + // 2- if set locally, apply its value + // 3- if not set locally, check if it's set globally via ir.config_parameter + // 4- if set globally, apply its value + // 5- if not set globally either, check if returned values are more than node's limit + if (!_.isUndefined(self.nodeOptions.search_more)) { + var search_more = self.is_option_set( + self.nodeOptions.search_more + ); + } else if ( + !_.isUndefined(self.ir_options["web_m2x_options.search_more"]) + ) { + var search_more = self.is_option_set( self.ir_options["web_m2x_options.search_more"] ); + } else { + var search_more = values.length > self.limit; + } - if (values.length > self.limit) { + if (search_more) { values = values.slice(0, self.limit); - if (can_search_more || search_more_undef || search_more) { - values.push({ - label: _t("Search More..."), - action: function () { - var prom = []; - if (search_val !== "") { - prom = self._rpc({ - model: self.field.relation, - method: "name_search", - kwargs: { - name: search_val, - args: domain, - operator: "ilike", - limit: self.SEARCH_MORE_LIMIT, - context: context, - }, - }); - } - Promise.resolve(prom).then(function (results) { - var dynamicFilters = []; - if (results) { - var ids = _.map(results, function (x) { - return x[0]; - }); - if (search_val) { - dynamicFilters = [ - { - description: _.str.sprintf( - _t("Quick search: %s"), - search_val - ), - domain: [["id", "in", ids]], - }, - ]; - } else { - dynamicFilters = []; - } - } - self._searchCreatePopup( - "search", - false, - {}, - dynamicFilters - ); + values.push({ + label: _t("Search More..."), + action: function () { + var prom = []; + if (search_val !== "") { + prom = self._rpc({ + model: self.field.relation, + method: "name_search", + kwargs: { + name: search_val, + args: domain, + operator: "ilike", + limit: self.SEARCH_MORE_LIMIT, + context: context, + }, }); - }, - classname: "o_m2o_dropdown_option", - }); - } + } + Promise.resolve(prom).then(function (results) { + var dynamicFilters = []; + if (results) { + var ids = _.map(results, function (x) { + return x[0]; + }); + if (search_val) { + dynamicFilters = [ + { + description: _.str.sprintf( + _t("Quick search: %s"), + search_val + ), + domain: [["id", "in", ids]], + }, + ]; + } else { + dynamicFilters = []; + } + } + self._searchCreatePopup( + "search", + false, + {}, + dynamicFilters + ); + }); + }, + classname: "o_m2o_dropdown_option", + }); } var create_enabled = self.can_create && !self.nodeOptions.no_create; From 5a7fbfec0d6499a7dd3823ed21c6467bb7e9685e Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Tue, 7 Apr 2020 11:33:17 +0200 Subject: [PATCH 2/6] [FIX] when all is undefined, fall back to core's default --- web_m2x_options/static/src/xml/base.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_m2x_options/static/src/xml/base.xml b/web_m2x_options/static/src/xml/base.xml index a4f5ae3c7..d2ac41b8a 100644 --- a/web_m2x_options/static/src/xml/base.xml +++ b/web_m2x_options/static/src/xml/base.xml @@ -5,7 +5,7 @@ - !(widget.nodeOptions.no_open || widget.nodeOptions.no_open_edit) + !(widget.nodeOptions.no_open || widget.nodeOptions.no_open_edit || widget.noOpen) From acec64f61fae10eb02c0ccfad8273bece13be930 Mon Sep 17 00:00:00 2001 From: Quentin Groulard Date: Fri, 24 Jan 2020 17:07:20 +0100 Subject: [PATCH 3/6] [ADD] Option open for One2Many fields With 'open' option, clicking on a row of a o2m field will open the view for the record in fullscreen rather than in a popup --- web_m2x_options/readme/USAGE.rst | 2 +- web_m2x_options/static/src/js/form.js | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/web_m2x_options/readme/USAGE.rst b/web_m2x_options/readme/USAGE.rst index 1da37a228..65ab3e969 100644 --- a/web_m2x_options/readme/USAGE.rst +++ b/web_m2x_options/readme/USAGE.rst @@ -37,7 +37,7 @@ in the field's options dict ``open`` *boolean* (Default: ``False``) - Makes many2many_tags buttons that open the linked resource + Makes many2many_tags and one2many rows buttons that open the linked resource ``no_color_picker`` *boolean* (Default: ``False``) diff --git a/web_m2x_options/static/src/js/form.js b/web_m2x_options/static/src/js/form.js index cfabc0733..2ca088fe8 100644 --- a/web_m2x_options/static/src/js/form.js +++ b/web_m2x_options/static/src/js/form.js @@ -13,6 +13,7 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) { var _t = core._t, FieldMany2ManyTags = relational_fields.FieldMany2ManyTags, FieldMany2One = relational_fields.FieldMany2One, + FieldOne2Many = relational_fields.FieldOne2Many, FormFieldMany2ManyTags = relational_fields.FormFieldMany2ManyTags; var web_m2x_options = rpc.query({ @@ -461,6 +462,29 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) { }, }); + FieldOne2Many.include({ + _onOpenRecord: function (ev) { + var self = this; + var open = this.nodeOptions.open; + if (open && self.mode === "readonly") { + ev.stopPropagation(); + var id = ev.data.id; + var res_id = self.record.data[self.name].data.filter( + (line) => line.id === id + )[0].res_id; + self._rpc({ + model: self.field.relation, + method: "get_formview_action", + args: [[res_id]], + }).then(function (action) { + return self.do_action(action); + }); + } else { + return this._super.apply(this, arguments); + } + }, + }); + FormFieldMany2ManyTags.include({ events: _.extend({}, FormFieldMany2ManyTags.prototype.events, { "click .badge": "_onOpenBadge", From 7fb6885241935a520d3a8f071bc4e6a481e43b49 Mon Sep 17 00:00:00 2001 From: Carlos Roca Date: Mon, 9 Nov 2020 10:19:56 +0100 Subject: [PATCH 4/6] [IMP] web_m2x_options: Efficiency Improved the efficiency of code: With this improvement we achieve to just do an rpc call when the js file is called instead of do the call for each field. --- web_m2x_options/README.rst | 3 +- web_m2x_options/__manifest__.py | 5 +- web_m2x_options/models/ir_config_parameter.py | 5 +- web_m2x_options/readme/CONTRIBUTORS.rst | 1 + web_m2x_options/static/src/js/form.js | 110 +++++++----------- web_m2x_options/static/src/js/ir_options.js | 12 ++ 6 files changed, 64 insertions(+), 72 deletions(-) create mode 100644 web_m2x_options/static/src/js/ir_options.js diff --git a/web_m2x_options/README.rst b/web_m2x_options/README.rst index ed857f9ce..ab6953eee 100644 --- a/web_m2x_options/README.rst +++ b/web_m2x_options/README.rst @@ -23,7 +23,7 @@ web_m2x_options :target: https://runbot.odoo-community.org/runbot/162/15.0 :alt: Try me on Runbot -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| This modules modifies "many2one" and "many2manytags" form widgets so as to add some new display control options. @@ -178,6 +178,7 @@ Contributors * Jairo Llopis * David Vidal * Ernesto Tejeda + * Carlos Roca * Bhavesh Odedra * Dhara Solanki (http://www.initos.com) diff --git a/web_m2x_options/__manifest__.py b/web_m2x_options/__manifest__.py index 0b3c94410..d865feb56 100644 --- a/web_m2x_options/__manifest__.py +++ b/web_m2x_options/__manifest__.py @@ -17,7 +17,10 @@ "license": "AGPL-3", "depends": ["web"], "assets": { - "web.assets_backend": ["web_m2x_options/static/src/js/form.js"], + "web.assets_backend": [ + "web_m2x_options/static/src/js/form.js", + "web_m2x_options/static/src/js/ir_options.js", + ], "web.assets_qweb": ["web_m2x_options/static/src/xml/base.xml"], }, "installable": True, diff --git a/web_m2x_options/models/ir_config_parameter.py b/web_m2x_options/models/ir_config_parameter.py index 8e7228f08..26638d038 100644 --- a/web_m2x_options/models/ir_config_parameter.py +++ b/web_m2x_options/models/ir_config_parameter.py @@ -13,4 +13,7 @@ class IrConfigParameter(models.Model): "web_m2x_options.search_more", "web_m2x_options.m2o_dialog", ] - return self.sudo().search_read([["key", "in", opts]], ["key", "value"]) + return { + res["key"]: res["value"] + for res in self.sudo().search_read([["key", "in", opts]], ["key", "value"]) + } diff --git a/web_m2x_options/readme/CONTRIBUTORS.rst b/web_m2x_options/readme/CONTRIBUTORS.rst index 9838a8c21..c42c7afe7 100644 --- a/web_m2x_options/readme/CONTRIBUTORS.rst +++ b/web_m2x_options/readme/CONTRIBUTORS.rst @@ -9,5 +9,6 @@ * Jairo Llopis * David Vidal * Ernesto Tejeda + * Carlos Roca * Bhavesh Odedra * Dhara Solanki (http://www.initos.com) diff --git a/web_m2x_options/static/src/js/form.js b/web_m2x_options/static/src/js/form.js index 2ca088fe8..9f67758d2 100644 --- a/web_m2x_options/static/src/js/form.js +++ b/web_m2x_options/static/src/js/form.js @@ -6,9 +6,10 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) { var core = require("web.core"), data = require("web.data"), Dialog = require("web.Dialog"), + FormView = require("web.FormView"), view_dialogs = require("web.view_dialogs"), relational_fields = require("web.relational_fields"), - rpc = require("web.rpc"); + ir_options = require("web_m2x_options.ir_options"); var _t = core._t, FieldMany2ManyTags = relational_fields.FieldMany2ManyTags, @@ -16,10 +17,12 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) { FieldOne2Many = relational_fields.FieldOne2Many, FormFieldMany2ManyTags = relational_fields.FormFieldMany2ManyTags; - var web_m2x_options = rpc.query({ - model: "ir.config_parameter", - method: "get_web_m2x_options", - }); + function is_option_set(option) { + if (_.isUndefined(option)) return false; + if (typeof option === "string") return option === "true" || option === "True"; + if (typeof option === "boolean") return option; + return false; + } var M2ODialog = Dialog.extend({ template: "M2ODialog", @@ -93,43 +96,13 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) { }); FieldMany2One.include({ - start: function () { - this._super.apply(this, arguments); - return this.get_options(); - }, - - get_options: function () { - var self = this; - if (_.isUndefined(this.ir_options_loaded)) { - this.ir_options_loaded = $.Deferred(); - this.ir_options = {}; - web_m2x_options.then(function (records) { - _(records).each(function (record) { - self.ir_options[record.key] = record.value; - }); - self.ir_options_loaded.resolve(); - }); - } - return $.when(); - }, - - is_option_set: function (option) { - if (_.isUndefined(option)) return false; - if (typeof option === "string") - return option === "true" || option === "True"; - if (typeof option === "boolean") return option; - return false; - }, - _onInputFocusout: function () { var m2o_dialog_opt = - this.is_option_set(this.nodeOptions.m2o_dialog) || + is_option_set(this.nodeOptions.m2o_dialog) || (_.isUndefined(this.nodeOptions.m2o_dialog) && - this.is_option_set( - this.ir_options["web_m2x_options.m2o_dialog"] - )) || + is_option_set(ir_options["web_m2x_options.m2o_dialog"])) || (_.isUndefined(this.nodeOptions.m2o_dialog) && - _.isUndefined(this.ir_options["web_m2x_options.m2o_dialog"])); + _.isUndefined(ir_options["web_m2x_options.m2o_dialog"])); if (this.can_create && this.floating && m2o_dialog_opt) { new M2ODialog(this, this.string, this.$input.val()).open(); } @@ -137,14 +110,12 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) { _search: function (search_val) { var self = this; - if (search_val === undefined) { - return this._super.apply(this, arguments); - } + var def = new Promise((resolve) => { // Add options limit used to change number of selections record // returned. - if (!_.isUndefined(self.ir_options["web_m2x_options.limit"])) { - this.limit = parseInt(self.ir_options["web_m2x_options.limit"], 10); + if (!_.isUndefined(ir_options["web_m2x_options.limit"])) { + this.limit = parseInt(ir_options["web_m2x_options.limit"], 10); } if (typeof self.nodeOptions.limit === "number") { @@ -230,14 +201,12 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) { // 4- if set globally, apply its value // 5- if not set globally either, check if returned values are more than node's limit if (!_.isUndefined(self.nodeOptions.search_more)) { - var search_more = self.is_option_set( - self.nodeOptions.search_more - ); + var search_more = is_option_set(self.nodeOptions.search_more); } else if ( - !_.isUndefined(self.ir_options["web_m2x_options.search_more"]) + !_.isUndefined(ir_options["web_m2x_options.search_more"]) ) { - var search_more = self.is_option_set( - self.ir_options["web_m2x_options.search_more"] + var search_more = is_option_set( + ir_options["web_m2x_options.search_more"] ); } else { var search_more = values.length > self.limit; @@ -299,13 +268,13 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) { var raw_result = _.map(result, function (x) { return x[1]; }); - var quick_create = self.is_option_set(self.nodeOptions.create), + var quick_create = is_option_set(self.nodeOptions.create), quick_create_undef = _.isUndefined(self.nodeOptions.create), m2x_create_undef = _.isUndefined( - self.ir_options["web_m2x_options.create"] + ir_options["web_m2x_options.create"] ), - m2x_create = self.is_option_set( - self.ir_options["web_m2x_options.create"] + m2x_create = is_option_set( + ir_options["web_m2x_options.create"] ); var show_create = (!self.nodeOptions && (m2x_create_undef || m2x_create)) || @@ -332,16 +301,16 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) { // Create and edit ... var create_edit = - self.is_option_set(self.nodeOptions.create) || - self.is_option_set(self.nodeOptions.create_edit), + is_option_set(self.nodeOptions.create) || + is_option_set(self.nodeOptions.create_edit), create_edit_undef = _.isUndefined(self.nodeOptions.create) && _.isUndefined(self.nodeOptions.create_edit), m2x_create_edit_undef = _.isUndefined( - self.ir_options["web_m2x_options.create_edit"] + ir_options["web_m2x_options.create_edit"] ), - m2x_create_edit = self.is_option_set( - self.ir_options["web_m2x_options.create_edit"] + m2x_create_edit = is_option_set( + ir_options["web_m2x_options.create_edit"] ); var show_create_edit = (!self.nodeOptions && @@ -381,6 +350,17 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) { }); }); this.orderer.add(def); + + // Add options limit used to change number of selections record + // returned. + if (!_.isUndefined(ir_options["web_m2x_options.limit"])) { + this.limit = parseInt(ir_options["web_m2x_options.limit"], 10); + } + + if (typeof this.nodeOptions.limit === "number") { + this.limit = this.nodeOptions.limit; + } + return def; }, }); @@ -396,17 +376,9 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) { return result; }, - is_option_set: function (option) { - if (_.isUndefined(option)) return false; - if (typeof option === "string") - return option === "true" || option === "True"; - if (typeof option === "boolean") return option; - return false; - }, - _onOpenBadge: function (event) { var self = this; - var open = self.nodeOptions && self.is_option_set(self.nodeOptions.open); + var open = self.nodeOptions && is_option_set(self.nodeOptions.open); if (open) { var context = self.record.getContext(self.recordParams); var id = parseInt($(event.currentTarget).data("id"), 10); @@ -491,8 +463,8 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) { }), _onOpenBadge: function (event) { - var open = this.is_option_set(this.nodeOptions.open); - var no_color_picker = this.is_option_set(this.nodeOptions.no_color_picker); + var open = is_option_set(this.nodeOptions.open); + var no_color_picker = is_option_set(this.nodeOptions.no_color_picker); this._super.apply(this, arguments); if (!open && !no_color_picker) { this._onOpenColorPicker(event); diff --git a/web_m2x_options/static/src/js/ir_options.js b/web_m2x_options/static/src/js/ir_options.js new file mode 100644 index 000000000..293c66c51 --- /dev/null +++ b/web_m2x_options/static/src/js/ir_options.js @@ -0,0 +1,12 @@ +/* Copyright 2020 Tecnativa - Carlos Roca + * * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ +odoo.define("web_m2x_options.ir_options", function (require) { + "use strict"; + + var rpc = require("web.rpc"); + + return rpc.query({ + model: "ir.config_parameter", + method: "get_web_m2x_options", + }); +}); From e7e795ccdd853da269afdb4c9e7fd369d190a3b9 Mon Sep 17 00:00:00 2001 From: Carlos Roca Date: Mon, 9 Nov 2020 12:00:09 +0100 Subject: [PATCH 5/6] [IMP] web_m2x_options: Added limit for o2m field entries Added the system parameter "web_m2x_options.field_limit_entries" to set the limit of entries that can be displayed. --- web_m2x_options/README.rst | 5 +++++ web_m2x_options/models/ir_config_parameter.py | 1 + web_m2x_options/readme/USAGE.rst | 5 +++++ web_m2x_options/static/src/js/form.js | 12 ++++++++++++ 4 files changed, 23 insertions(+) diff --git a/web_m2x_options/README.rst b/web_m2x_options/README.rst index ab6953eee..966303a60 100644 --- a/web_m2x_options/README.rst +++ b/web_m2x_options/README.rst @@ -115,6 +115,10 @@ If you disable one option, you can enable it for particular field by setting "cr Whether the field should always show "Search more..." entry or not. +``web_m2x_options.field_limit_entries`` *int* + + Number of displayed lines on all One2many fields + To add these parameters go to Configuration -> Technical -> Parameters -> System Parameters and add new parameters like: - web_m2x_options.create: False @@ -122,6 +126,7 @@ To add these parameters go to Configuration -> Technical -> Parameters -> System - web_m2x_options.m2o_dialog: False - web_m2x_options.limit: 10 - web_m2x_options.search_more: True +- web_m2x_options.field_limit_entries: 5 Example diff --git a/web_m2x_options/models/ir_config_parameter.py b/web_m2x_options/models/ir_config_parameter.py index 26638d038..f6d7b17f7 100644 --- a/web_m2x_options/models/ir_config_parameter.py +++ b/web_m2x_options/models/ir_config_parameter.py @@ -12,6 +12,7 @@ class IrConfigParameter(models.Model): "web_m2x_options.limit", "web_m2x_options.search_more", "web_m2x_options.m2o_dialog", + "web_m2x_options.field_limit_entries", ] return { res["key"]: res["value"] diff --git a/web_m2x_options/readme/USAGE.rst b/web_m2x_options/readme/USAGE.rst index 65ab3e969..b6bb6aa2e 100644 --- a/web_m2x_options/readme/USAGE.rst +++ b/web_m2x_options/readme/USAGE.rst @@ -69,6 +69,10 @@ If you disable one option, you can enable it for particular field by setting "cr Whether the field should always show "Search more..." entry or not. +``web_m2x_options.field_limit_entries`` *int* + + Number of displayed lines on all One2many fields + To add these parameters go to Configuration -> Technical -> Parameters -> System Parameters and add new parameters like: - web_m2x_options.create: False @@ -76,6 +80,7 @@ To add these parameters go to Configuration -> Technical -> Parameters -> System - web_m2x_options.m2o_dialog: False - web_m2x_options.limit: 10 - web_m2x_options.search_more: True +- web_m2x_options.field_limit_entries: 5 Example diff --git a/web_m2x_options/static/src/js/form.js b/web_m2x_options/static/src/js/form.js index 9f67758d2..46359c4bf 100644 --- a/web_m2x_options/static/src/js/form.js +++ b/web_m2x_options/static/src/js/form.js @@ -474,4 +474,16 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) { } }, }); + + // Extending class to allow change the limit of o2m registry entries using the + // system parameter "web_m2x_options.field_limit_entries". + FormView.include({ + _setSubViewLimit: function (attrs) { + this._super(attrs); + var limit = ir_options["web_m2x_options.field_limit_entries"]; + if (!_.isUndefined(limit)) { + attrs.limit = parseInt(limit); + } + }, + }); }); From 31a5e8e947c386c93f8b4695359225d7caa32412 Mon Sep 17 00:00:00 2001 From: nguyenhk Date: Tue, 21 Dec 2021 10:22:55 +0700 Subject: [PATCH 6/6] [FIX] web_m2x_options: fix test_ir_config_parameter --- web_m2x_options/models/ir_config_parameter.py | 6 ++---- .../tests/test_ir_config_parameter.py | 16 +++++++--------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/web_m2x_options/models/ir_config_parameter.py b/web_m2x_options/models/ir_config_parameter.py index f6d7b17f7..c24506dd8 100644 --- a/web_m2x_options/models/ir_config_parameter.py +++ b/web_m2x_options/models/ir_config_parameter.py @@ -14,7 +14,5 @@ class IrConfigParameter(models.Model): "web_m2x_options.m2o_dialog", "web_m2x_options.field_limit_entries", ] - return { - res["key"]: res["value"] - for res in self.sudo().search_read([["key", "in", opts]], ["key", "value"]) - } + values = self.sudo().search_read([["key", "in", opts]], ["key", "value"]) + return {res["key"]: res["value"] for res in values} diff --git a/web_m2x_options/tests/test_ir_config_parameter.py b/web_m2x_options/tests/test_ir_config_parameter.py index d4262a252..eae00c7a9 100644 --- a/web_m2x_options/tests/test_ir_config_parameter.py +++ b/web_m2x_options/tests/test_ir_config_parameter.py @@ -16,15 +16,13 @@ class TestIrConfigParameter(common.TransactionCase): def test_web_m2x_options_key(self): web_m2x_options = self.env["ir.config_parameter"].get_web_m2x_options() - options = {opt["key"]: opt["value"] for opt in web_m2x_options} - self.assertIn("web_m2x_options.limit", options) - self.assertNotIn("web_m2x_options.m2o_dialog_test", options) + self.assertIn("web_m2x_options.limit", web_m2x_options) + self.assertNotIn("web_m2x_options.m2o_dialog_test", web_m2x_options) def test_web_m2x_options_value(self): web_m2x_options = self.env["ir.config_parameter"].get_web_m2x_options() - options = {opt["key"]: opt["value"] for opt in web_m2x_options} - self.assertEqual(options["web_m2x_options.limit"], "10") - self.assertTrue(bool(options["web_m2x_options.create_edit"])) - self.assertTrue(bool(options["web_m2x_options.create"])) - self.assertEqual(options["web_m2x_options.search_more"], "False") - self.assertTrue(bool(options["web_m2x_options.m2o_dialog"])) + self.assertEqual(web_m2x_options["web_m2x_options.limit"], "10") + self.assertTrue(bool(web_m2x_options["web_m2x_options.create_edit"])) + self.assertTrue(bool(web_m2x_options["web_m2x_options.create"])) + self.assertEqual(web_m2x_options["web_m2x_options.search_more"], "False") + self.assertTrue(bool(web_m2x_options["web_m2x_options.m2o_dialog"]))