[IMP] web_m2x_options: black, isort, prettier

pull/2888/head
dsolanki 2020-10-26 18:17:13 +05:30 committed by manu
parent d0fe81d1ac
commit 267d9abbad
1 changed files with 32 additions and 34 deletions

View File

@ -34,7 +34,7 @@ odoo.define("web_m2x_options.web_m2x_options", function(require) {
text: _t("Create"),
classes: "btn-primary",
click: function () {
if (this.$("input").val() !== "") {
if (this.$("input").val()) {
this.trigger_up("quick_create", {
value: this.$("input").val(),
});
@ -140,7 +140,7 @@ odoo.define("web_m2x_options.web_m2x_options", function(require) {
if (search_val === undefined) {
return this._super.apply(this, arguments);
}
var def = new Promise(resolve => {
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"])) {
@ -173,9 +173,9 @@ odoo.define("web_m2x_options.web_m2x_options", function(require) {
limit: self.limit + 1,
context: context,
},
}).then(result => {
}).then((result) => {
// Possible selections for the m2o
var values = _.map(result, x => {
var values = _.map(result, (x) => {
x[1] = self._getDisplayName(x[1]);
return {
label:
@ -197,7 +197,7 @@ odoo.define("web_m2x_options.web_m2x_options", function(require) {
method: "search_read",
fields: [self.field_color],
domain: [["id", "in", value_ids]],
}).then(objects => {
}).then((objects) => {
for (var index in objects) {
for (var index_value in values) {
if (values[index_value].id === objects[index].id) {
@ -317,9 +317,7 @@ odoo.define("web_m2x_options.web_m2x_options", function(require) {
values.push({
label: _.str.sprintf(
_t('Create "<strong>%s</strong>"'),
$("<span />")
.text(search_val)
.html()
$("<span />").text(search_val).html()
),
action: self._quickCreate.bind(self, search_val),
classname: "o_m2o_dropdown_option",