Move model definition files from `models/thing/thing.js` to
`models/thing.js` and remove the now empty intermediate directory.
Task-2759582
* = calendar, crm_livechat, hr, im_livechat, mail_bot, sms, snailmail,
website_livechat, website_slides
closes odoo/odoo#86464
Related: odoo/enterprise#25291
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
55 lines
1.6 KiB
JavaScript
55 lines
1.6 KiB
JavaScript
/** @odoo-module **/
|
|
|
|
import { registerModel } from '@mail/model/model_core';
|
|
import { attr, one } from '@mail/model/model_field';
|
|
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
|
|
|
registerModel({
|
|
name: 'AttachmentBoxView',
|
|
identifyingFields: ['chatter'],
|
|
recordMethods: {
|
|
/**
|
|
* Handles click on the "add attachment" button.
|
|
*/
|
|
onClickAddAttachment() {
|
|
this.fileUploader.openBrowserFileUploader();
|
|
},
|
|
/**
|
|
* @private
|
|
* @returns {FieldCommand}
|
|
*/
|
|
_computeAttachmentList() {
|
|
return (this.chatter.thread && this.chatter.thread.allAttachments.length > 0)
|
|
? insertAndReplace()
|
|
: clear();
|
|
},
|
|
},
|
|
fields: {
|
|
/**
|
|
* Determines the attachment list that will be used to display the attachments.
|
|
*/
|
|
attachmentList: one('AttachmentList', {
|
|
compute: '_computeAttachmentList',
|
|
inverse: 'attachmentBoxViewOwner',
|
|
isCausal: true,
|
|
readonly: true,
|
|
}),
|
|
chatter: one('Chatter', {
|
|
inverse: 'attachmentBoxView',
|
|
readonly: true,
|
|
required: true,
|
|
}),
|
|
/**
|
|
* States the OWL component displaying this attachment box.
|
|
*/
|
|
component: attr(),
|
|
fileUploader: one('FileUploader', {
|
|
default: insertAndReplace(),
|
|
inverse: 'attachmentBoxView',
|
|
isCausal: true,
|
|
readonly: true,
|
|
required: true,
|
|
}),
|
|
},
|
|
});
|