3
0
Fork 0

[IMP] web_widget_domain_editor_dialog: black, isort, prettier

15.0-ocabot-merge-pr-2789-by-pedrobaeza-bump-patch
hkapatel 2021-09-28 15:46:34 +05:30 committed by Carlos Lopez
parent 2a3d49f2ae
commit 4aa309a81c
2 changed files with 11 additions and 11 deletions

View File

@ -1,7 +1,7 @@
/* Copyright 2019 Tecnativa - David Vidal /* Copyright 2019 Tecnativa - David Vidal
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
odoo.define("web_widget_domain_editor_dialog.basic_fields", function(require) { odoo.define("web_widget_domain_editor_dialog.basic_fields", function (require) {
"use strict"; "use strict";
const core = require("web.core"); const core = require("web.core");
@ -10,7 +10,7 @@ odoo.define("web_widget_domain_editor_dialog.basic_fields", function(require) {
const _t = core._t; const _t = core._t;
basic_fields.FieldDomain.include({ basic_fields.FieldDomain.include({
_onShowSelectionButtonClick: function(event) { _onShowSelectionButtonClick: function (event) {
event.preventDefault(); event.preventDefault();
const _this = this; const _this = this;
if (this.mode === "readonly") { if (this.mode === "readonly") {
@ -26,7 +26,7 @@ odoo.define("web_widget_domain_editor_dialog.basic_fields", function(require) {
readonly: false, readonly: false,
disable_multiple_selection: false, disable_multiple_selection: false,
no_create: true, no_create: true,
on_selected: function(selected_ids) { on_selected: function (selected_ids) {
_this.domainSelector _this.domainSelector
.setDomain(this.get_domain(selected_ids)) .setDomain(this.get_domain(selected_ids))
.then(_this._replaceContent.bind(_this)); .then(_this._replaceContent.bind(_this));

View File

@ -1,7 +1,7 @@
/* Copyright 2019 Tecnativa - David Vidal /* Copyright 2019 Tecnativa - David Vidal
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
odoo.define("web_widget_domain_editor_dialog.DomainEditorDialog", function(require) { odoo.define("web_widget_domain_editor_dialog.DomainEditorDialog", function (require) {
"use strict"; "use strict";
const core = require("web.core"); const core = require("web.core");
@ -10,7 +10,7 @@ odoo.define("web_widget_domain_editor_dialog.DomainEditorDialog", function(requi
const _t = core._t; const _t = core._t;
const DomainEditorDialog = view_dialogs.SelectCreateDialog.extend({ const DomainEditorDialog = view_dialogs.SelectCreateDialog.extend({
init: function() { init: function () {
this._super.apply(this, arguments); this._super.apply(this, arguments);
const _this = this; const _this = this;
this.options = _.defaults(this.options, { this.options = _.defaults(this.options, {
@ -24,23 +24,23 @@ odoo.define("web_widget_domain_editor_dialog.DomainEditorDialog", function(requi
], ],
}); });
}, },
get_domain: function(selected_ids) { get_domain: function (selected_ids) {
let group_domain = []; let group_domain = [];
const search_data = this.viewController.renderer.state; const search_data = this.viewController.renderer.state;
let domain = search_data.domain; let domain = search_data.domain;
if (this.$(".o_list_record_selector input").prop("checked")) { if (this.$(".o_list_record_selector input").prop("checked")) {
if (search_data.groupedBy.length) { if (search_data.groupedBy.length) {
group_domain = _.filter(search_data.data, x => { group_domain = _.filter(search_data.data, (x) => {
return x.res_ids.length; return x.res_ids.length;
}).map(x => { }).map((x) => {
return x.domain; return x.domain;
}); });
group_domain = _.flatten(group_domain, true); group_domain = _.flatten(group_domain, true);
// Compute domain difference // Compute domain difference
_.each(domain, d => { _.each(domain, (d) => {
group_domain = _.without( group_domain = _.without(
group_domain, group_domain,
_.filter(group_domain, x => { _.filter(group_domain, (x) => {
return _.isEqual(x, d); return _.isEqual(x, d);
})[0] })[0]
); );
@ -54,7 +54,7 @@ odoo.define("web_widget_domain_editor_dialog.DomainEditorDialog", function(requi
).concat(group_domain); ).concat(group_domain);
} }
} else { } else {
const ids = selected_ids.map(x => { const ids = selected_ids.map((x) => {
return x.id; return x.id;
}); });
domain = domain.concat([["id", "in", ids]]); domain = domain.concat([["id", "in", ids]]);