Skip to content

Commit

Permalink
[FIX] dms: Correctly filter records when selecting a searchpanel item…
Browse files Browse the repository at this point in the history
… (similar to v15)

In the migration to 16.0 this behavior was removed by mistake and was only done in directories
05f7c67#diff-1bb531d306f9014026b38b47879cd2cc7bcb1deaebb7466327f4483a0a459fc3R25
  • Loading branch information
victoralmau committed Jan 5, 2024
1 parent f439c3d commit 56bd76d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
14 changes: 6 additions & 8 deletions dms/static/src/js/views/search_panel.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @odoo-module **/
/* Copyright 2021-2022 Tecnativa - Víctor Martínez
/* Copyright 2021-2024 Tecnativa - Víctor Martínez
* License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */

import {SearchModel} from "@web/search/search_model";
Expand All @@ -17,13 +17,11 @@ patch(SearchModel.prototype, "dms.SearchPanel", {
continue;
}

if (this.resModel === "dms.directory") {
if (category.activeValueId) {
domain.push([category.fieldName, "=", category.activeValueId]);
}
if (domain.length === 0) {
domain.push([category.fieldName, "=", false]);
}
if (category.activeValueId) {
domain.push([category.fieldName, "=", category.activeValueId]);
}
if (domain.length === 0 && this.resModel === "dms.directory") {
domain.push([category.fieldName, "=", false]);
}
}
return domain;
Expand Down
1 change: 0 additions & 1 deletion dms/views/directory.xml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@
icon="fa-folder"
limit="0"
enable_counters="1"
operator="="
/>
<field
name="category_id"
Expand Down
2 changes: 0 additions & 2 deletions dms/views/dms_file.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
name="directory_id"
icon="fa-folder"
limit="0"
operator="="
enable_counters="1"
/>
<field
Expand Down Expand Up @@ -573,7 +572,6 @@
icon="fa-folder"
limit="0"
enable_counters="1"
operator="="
/>
<field
name="category_id"
Expand Down

0 comments on commit 56bd76d

Please sign in to comment.