mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-19 07:12:04 +02:00
Initial commit: OCA Technical packages (595 packages)
This commit is contained in:
commit
2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions
|
|
@ -0,0 +1,33 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import {registerPatch} from "@mail/model/model_core";
|
||||
|
||||
registerPatch({
|
||||
name: "AttachmentImage",
|
||||
fields: {
|
||||
imageUrl: {
|
||||
compute() {
|
||||
if (!this.attachment) {
|
||||
return;
|
||||
}
|
||||
if (
|
||||
!this.attachment.accessToken &&
|
||||
this.attachment.originThread &&
|
||||
this.attachment.originThread.model === "mail.channel"
|
||||
) {
|
||||
return `/mail/channel/${this.attachment.originThread.id}/image/${this.attachment.id}/${this.width}x${this.height}`;
|
||||
}
|
||||
const accessToken = this.attachment.accessToken
|
||||
? `?access_token=${this.attachment.accessToken}`
|
||||
: "";
|
||||
if (
|
||||
this.attachment.model_name &&
|
||||
this.attachment.model_name === "dms.file"
|
||||
) {
|
||||
return `/web/content?id=${this.attachment.id}&field=content&model=dms.file&filename_field=name&download=false`;
|
||||
}
|
||||
return `/web/image/${this.attachment.id}/${this.width}x${this.height}${accessToken}`;
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue