Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][FIX] dms_field: Show the correct image (same as kanban view) of the files in the right panel #357

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions dms_field/static/src/js/base/dms_tree_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ odoo.define("dms.DmsTreeController", function (require) {
"count_files",
"name",
"parent_id",
"icon_url",
"__last_update",
]),
domain: this._buildDMSDomain(
Expand Down Expand Up @@ -165,6 +166,7 @@ odoo.define("dms.DmsTreeController", function (require) {
"count_files",
"name",
"parent_id",
"icon_url",
"__last_update",
]),
domain: this._buildDMSDomain(
Expand All @@ -187,6 +189,7 @@ odoo.define("dms.DmsTreeController", function (require) {
"permission_create",
"permission_write",
"permission_unlink",
"icon_url",
"name",
"mimetype",
"directory_id",
Expand Down Expand Up @@ -383,13 +386,7 @@ odoo.define("dms.DmsTreeController", function (require) {
perm_create: directory.permission_create,
perm_write: directory.permission_write,
perm_unlink: directory.permission_unlink,

thumbnail_link: session.url("/web/image", {
model: "dms.directory",
field: "thumbnail_medium",
unique: directory.__last_update.replace(/[^0-9]/g, ""),
id: directory.id,
}),
icon_url: directory.icon_url,
});
if (
storage &&
Expand Down Expand Up @@ -434,12 +431,7 @@ odoo.define("dms.DmsTreeController", function (require) {
file.permission_write && (!file.is_locked || file.is_lock_editor),
perm_unlink:
file.permission_unlink && (!file.is_locked || file.is_lock_editor),
thumbnail_link: session.url("/web/image", {
model: "dms.file",
field: "thumbnail_medium",
unique: file.__last_update.replace(/[^0-9]/g, ""),
id: file.id,
}),
icon_url: file.icon_url,
});
var dt = this._makeDataPoint({
data: data,
Expand Down
13 changes: 12 additions & 1 deletion dms_field/static/src/xml/preview.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,20 @@
<div class="o_preview_directory_icon" align="center">
<div>
<img
t-if="dms_object.model === 'dms.directory'"
class="h-100 w-100"
t-att-src="dms_object.data.thumbnail_link"
t-att-src="dms_object.data.icon_url"
/>
<a
t-if="dms_object.model === 'dms.file'"
class="o_preview_file"
t-att-data-id="dms_object.id"
>
<img
class="h-100 w-100"
t-att-src="dms_object.data.icon_url"
/>
</a>
</div>
<div>
<button
Expand Down
Loading