Skip to content

Commit

Permalink
Merge pull request #1 from gfcapalbo/14.0-web_advanced_search-select-…
Browse files Browse the repository at this point in the history
…dialog

14.0 web advanced search select dialog
  • Loading branch information
NL66278 authored Aug 9, 2023
2 parents 61096c5 + 326b8e6 commit 99395b6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ odoo.define("web_advanced_search.AdvancedSelectDialog", function (require) {
const dialogs = require("web.view_dialogs");

const AdvancedSelectDialog = dialogs.SelectCreateDialog.extend({
open: function (open) {
var self = this;
return this._super().then(function() {
self.opened().then( function() {
self.trigger_up("controller_update", {'start': true});
});
})
},
/**
* - Prevent dialog from closing when clicking on line.
* - Make sure Use Criteria button only shown when criteria selected.
Expand All @@ -22,15 +30,17 @@ odoo.define("web_advanced_search.AdvancedSelectDialog", function (require) {
controller_update: function (event) {
event.stopPropagation();
if (this.$footer) {
if (event.data.start === true) {
this.$footer.find(".o_use_criteria_button").hide()
return
}
const state = event.data.state;
const domain = state.getDomain();
let disable_criteria = true;
if (domain && domain.length > 0) {
disable_criteria = false;
}
this.$footer
.find(".o_use_criteria_button")
.prop("disabled", disable_criteria);
this.$footer.find(".o_use_criteria_button").show()
} else {
this.$footer.find(".o_use_criteria_button").hide()
}
}
},
}
Expand Down Expand Up @@ -65,7 +75,7 @@ odoo.define("web_advanced_search.AdvancedSelectDialog", function (require) {
{
text: _t("Use criteria"),
classes: "btn-primary o_use_criteria_button",
disabled: true,
disabled: false,
close: true,
click: function () {
let description = "Criteria Selected";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
/* Copyright 2021 Therp BV {https://therp.nl>.
* License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
*/

odoo.define("web_advanced_search.select_create_list_controller", function (require) {
"use strict";
const controller_registry = require("web.select_create_controllers_registry");
const selectCreateController = controller_registry.SelectCreateListController;

require("web.view_dialogs");
var controller_registry = require("web.select_create_controllers_registry");
require("web._select_create_controllers_registry");
var selectCreateController = controller_registry.SelectCreateListController;

selectCreateController.include({
async _update(state, params) {
return this._super(state, params).then(
Expand Down

0 comments on commit 99395b6

Please sign in to comment.