forked from Techsystech/web
[REF] web_m2x_options: better imp and fixes
parent
a993135504
commit
8ead30d4ea
|
@ -4,8 +4,8 @@
|
||||||
* Nicolas JEUDY <nicolas@sudokeys.com>
|
* Nicolas JEUDY <nicolas@sudokeys.com>
|
||||||
* Yannick Vaucher <yannick.vaucher@camptocamp.com>
|
* Yannick Vaucher <yannick.vaucher@camptocamp.com>
|
||||||
* Zakaria Makrelouf <z.makrelouf@gmail.com>
|
* Zakaria Makrelouf <z.makrelouf@gmail.com>
|
||||||
* Tecnativa <https://www.tecnativa.com>
|
* `Tecnativa <https://www.tecnativa.com>`_:
|
||||||
* Jairo Llopis <jairo.llopis@tecnativa.com>
|
|
||||||
* David Vidal <david.vidal@tecnativa.com>
|
* Jairo Llopis <jairo.llopis@tecnativa.com>
|
||||||
* Ernesto Tejeda <ernesto.tejeda87@gmail.com>
|
* David Vidal <david.vidal@tecnativa.com>
|
||||||
* Jeroen Evens <jeroen.evens@dynapps.be>
|
* Ernesto Tejeda <ernesto.tejeda87@gmail.com>
|
||||||
|
|
|
@ -119,12 +119,11 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) {
|
||||||
},
|
},
|
||||||
|
|
||||||
_search: function (search_val) {
|
_search: function (search_val) {
|
||||||
var self = this;
|
var def = new Promise(resolve => {
|
||||||
var def = new Promise(function (resolve) {
|
|
||||||
// add options limit used to change number of selections record
|
// add options limit used to change number of selections record
|
||||||
// returned.
|
// returned.
|
||||||
if (!_.isUndefined(self.ir_options['web_m2x_options.limit'])) {
|
if (!_.isUndefined(self.ir_options['web_m2x_options.limit'])) {
|
||||||
self.limit = parseInt(self.ir_options['web_m2x_options.limit'], 10);
|
this.limit = parseInt(self.ir_options['web_m2x_options.limit'], 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof self.nodeOptions.limit === 'number') {
|
if (typeof self.nodeOptions.limit === 'number') {
|
||||||
|
@ -153,9 +152,9 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) {
|
||||||
limit: self.limit + 1,
|
limit: self.limit + 1,
|
||||||
context: context,
|
context: context,
|
||||||
}
|
}
|
||||||
}).then(function (result) {
|
}).then(result => {
|
||||||
// possible selections for the m2o
|
// possible selections for the m2o
|
||||||
var values = _.map(result, function (x) {
|
var values = _.map(result, x => {
|
||||||
x[1] = self._getDisplayName(x[1]);
|
x[1] = self._getDisplayName(x[1]);
|
||||||
return {
|
return {
|
||||||
label: _.str.escapeHTML(x[1].trim()) || data.noDisplayContent,
|
label: _.str.escapeHTML(x[1].trim()) || data.noDisplayContent,
|
||||||
|
@ -176,7 +175,7 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) {
|
||||||
method: 'search_read',
|
method: 'search_read',
|
||||||
fields: [self.field_color],
|
fields: [self.field_color],
|
||||||
domain: [['id', 'in', value_ids]]
|
domain: [['id', 'in', value_ids]]
|
||||||
}).then(function (objects) {
|
}).then(objects => {
|
||||||
for (var index in objects) {
|
for (var index in objects) {
|
||||||
for (var index_value in values) {
|
for (var index_value in values) {
|
||||||
if (values[index_value].id == objects[index].id) {
|
if (values[index_value].id == objects[index].id) {
|
||||||
|
|
Loading…
Reference in New Issue