Skip to content

Commit 0789d8f

Browse files
committed
[FIX] Makes the module compatible with Odoo community
1 parent 480bcea commit 0789d8f

File tree

1 file changed

+9
-4
lines changed
  • web_m2x_options/static/src/js

1 file changed

+9
-4
lines changed

web_m2x_options/static/src/js/form.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) {
1919
'web_m2x_options.search_more',
2020
'web_m2x_options.m2o_dialog',];
2121

22+
// In odoo 9.c FielMany2One is not exposed by form_relational
23+
// To bypass this limitation we use the widget registry to get the
24+
// reference to the FielMany2One widget.
25+
var FieldMany2One = core.form_widget_registry.get('many2one');
26+
2227
var M2ODialog = Dialog.extend({
2328
template: "M2ODialog",
2429
init: function(parent) {
@@ -52,7 +57,7 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) {
5257
},
5358
});
5459

55-
form_relational.FieldMany2One.include({
60+
FieldMany2One.include({
5661

5762
start: function() {
5863
this._super.apply(this, arguments);
@@ -188,12 +193,12 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) {
188193
values.push({
189194
label: _t("Search More..."),
190195
action: function () {
191-
// limit = 80 for improving performance, similar
196+
// limit = 160 for improving performance, similar
192197
// to Odoo implementation here:
193-
// https://github.com/odoo/odoo/commit/8c3cdce539d87775b59b3f2d5ceb433f995821bf
198+
// https://github.com/odoo/odoo/blob/feeac2a4f1cd777770dd2b42534904ac71f23e46/addons/web/static/src/js/views/form_common.js#L213
194199
dataset.name_search(
195200
search_val, self.build_domain(),
196-
'ilike', 80).done(function (data) {
201+
'ilike', 160).done(function (data) {
197202
self._search_create_popup("search", data);
198203
});
199204
},

0 commit comments

Comments
 (0)