Initial commit: Mail packages

This commit is contained in:
Ernad Husremovic 2025-08-29 15:20:51 +02:00
commit 4e53507711
1948 changed files with 751201 additions and 0 deletions

View file

@ -0,0 +1,35 @@
/** @odoo-module **/
import '@mail/../tests/helpers/mock_server'; // ensure mail overrides are applied first
import { patch } from "@web/core/utils/patch";
import { MockServer } from "@web/../tests/helpers/mock_server";
patch(MockServer.prototype, 'im_livechat/controllers/main', {
/**
* @override
*/
async _performRPC(route, args) {
if (route === '/im_livechat/notify_typing') {
const uuid = args.uuid;
const is_typing = args.is_typing;
const context = args.context;
return this._mockRouteImLivechatNotifyTyping(uuid, is_typing, context);
}
return this._super(...arguments);
},
/**
* Simulates the `/im_livechat/notify_typing` route.
*
* @private
* @param {string} uuid
* @param {boolean} is_typing
* @param {Object} [context={}]
*/
_mockRouteImLivechatNotifyTyping(uuid, is_typing, context = {}) {
const [mailChannel] = this.getRecords('mail.channel', [['uuid', '=', uuid]]);
const partnerId = context.mockedPartnerId || this.currentPartnerId;
const [memberOfCurrentUser] = this.getRecords('mail.channel.member', [['channel_id', '=', mailChannel.id], ['partner_id', '=', partnerId]]);
this._mockMailChannelMember_NotifyTyping([memberOfCurrentUser.id], is_typing);
},
});

View file

@ -0,0 +1,40 @@
/** @odoo-module **/
import '@mail/../tests/helpers/mock_server/models/mail_channel_member'; // ensure mail overrides are applied first
import { patch } from "@web/core/utils/patch";
import { MockServer } from "@web/../tests/helpers/mock_server";
patch(MockServer.prototype, 'im_livechat/models/mail_channel_member', {
/**
* @override
*/
_mockMailChannelMember_GetPartnerData(ids) {
const [member] = this.getRecords('mail.channel.member', [['id', 'in', ids]]);
const [channel] = this.getRecords('mail.channel', [['id', '=', member.channel_id]]);
const [partner] = this.getRecords('res.partner', [['id', '=', member.partner_id]], { active_test: false });
if (channel.channel_type === 'livechat') {
const data = {
'id': partner.id,
'is_public': partner.is_public,
};
if (partner.user_livechat_username) {
data['user_livechat_username'] = partner.user_livechat_username;
} else {
data['name'] = partner.name;
}
if (!partner.is_public) {
const [country] = this.getRecords('res.country', [['id', '=', partner.country_id]]);
data['country'] = country
? {
'code': country.code,
'id': country.id,
'name': country.name,
}
: [['clear']];
}
return data;
}
return this._super(ids);
},
});