Files
odoo_source/addons/mail/static/src/models/thread_icon_view.js
T
Louis Wicket (wil) 8bd03d3984 [IMP] mail, *: move code from components to models (ThreadIcon)
Task-3002515.

* = hr_holidays, im_livechat

closes odoo/odoo#101774

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-10-06 14:56:44 +02:00

45 lines
1.5 KiB
JavaScript

/** @odoo-module **/
import { registerModel } from '@mail/model/model_core';
import { one } from '@mail/model/model_field';
registerModel({
name: 'ThreadIconView',
identifyingMode: 'xor',
fields: {
chatWindowHeaderViewOwner: one('ChatWindowHeaderView', {
identifying: true,
inverse: 'threadIconView',
}),
discussSidebarCategoryItemOwner: one('DiscussSidebarCategoryItem', {
identifying: true,
inverse: 'threadIconView',
}),
discussSidebarMailboxViewOwner: one('DiscussSidebarMailboxView', {
identifying: true,
inverse: 'threadIconView',
}),
thread: one('Thread', {
compute() {
if (this.chatWindowHeaderViewOwner) {
return this.chatWindowHeaderViewOwner.chatWindowOwner.thread;
}
if (this.discussSidebarCategoryItemOwner) {
return this.discussSidebarCategoryItemOwner.thread;
}
if (this.discussSidebarMailboxViewOwner) {
return this.discussSidebarMailboxViewOwner.mailbox.thread;
}
if (this.threadViewTopbarOwner) {
return this.threadViewTopbarOwner.thread
}
},
required: true,
}),
threadViewTopbarOwner: one('ThreadViewTopbar', {
identifying: true,
inverse: 'threadIconView',
}),
},
});