forked from Techsystech/web
[IMP] web_m2x_options: black, isort, prettier
parent
f9b689f06f
commit
50fc68b367
|
@ -34,7 +34,7 @@ odoo.define("web_m2x_options.web_m2x_options", function(require) {
|
||||||
text: _t("Create"),
|
text: _t("Create"),
|
||||||
classes: "btn-primary",
|
classes: "btn-primary",
|
||||||
click: function () {
|
click: function () {
|
||||||
if (this.$("input").val() !== "") {
|
if (this.$("input").val()) {
|
||||||
this.trigger_up("quick_create", {
|
this.trigger_up("quick_create", {
|
||||||
value: this.$("input").val(),
|
value: this.$("input").val(),
|
||||||
});
|
});
|
||||||
|
@ -140,7 +140,7 @@ odoo.define("web_m2x_options.web_m2x_options", function(require) {
|
||||||
if (search_val === undefined) {
|
if (search_val === undefined) {
|
||||||
return this._super.apply(this, arguments);
|
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
|
// 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"])) {
|
||||||
|
@ -173,9 +173,9 @@ odoo.define("web_m2x_options.web_m2x_options", function(require) {
|
||||||
limit: self.limit + 1,
|
limit: self.limit + 1,
|
||||||
context: context,
|
context: context,
|
||||||
},
|
},
|
||||||
}).then(result => {
|
}).then((result) => {
|
||||||
// Possible selections for the m2o
|
// Possible selections for the m2o
|
||||||
var values = _.map(result, x => {
|
var values = _.map(result, (x) => {
|
||||||
x[1] = self._getDisplayName(x[1]);
|
x[1] = self._getDisplayName(x[1]);
|
||||||
return {
|
return {
|
||||||
label:
|
label:
|
||||||
|
@ -197,7 +197,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(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) {
|
||||||
|
@ -317,9 +317,7 @@ odoo.define("web_m2x_options.web_m2x_options", function(require) {
|
||||||
values.push({
|
values.push({
|
||||||
label: _.str.sprintf(
|
label: _.str.sprintf(
|
||||||
_t('Create "<strong>%s</strong>"'),
|
_t('Create "<strong>%s</strong>"'),
|
||||||
$("<span />")
|
$("<span />").text(search_val).html()
|
||||||
.text(search_val)
|
|
||||||
.html()
|
|
||||||
),
|
),
|
||||||
action: self._quickCreate.bind(self, search_val),
|
action: self._quickCreate.bind(self, search_val),
|
||||||
classname: "o_m2o_dropdown_option",
|
classname: "o_m2o_dropdown_option",
|
||||||
|
|
Loading…
Reference in New Issue