Files
odoo_source/addons/im_livechat/static/tests/helpers/mock_models.js
T
Sébastien Theys efb66e8e7f [FIX] mail, im_livechat: make livechat work properly
- fix traceback on receiving first livechat message due to bad computation of
  correspondent
- fix missing [0] in return of country name_get in channel_info
- fix visitor/correspondent computation to work when chatting with oneself
- reintroduce livechat ordered by last message in discuss sidebar
- improve mock server to make these fixes possible to test
- introduce corresponding tests

PR: #56243
task-2323670

closes odoo/odoo#56423

X-original-commit: f623bfd2c8819604c709bc723153c071dca6e3cc
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-08-24 13:47:01 +00:00

43 lines
1.6 KiB
JavaScript

odoo.define('im_livechat/static/tests/helpers/mock_models.js', function (require) {
'use strict';
const MockModels = require('mail/static/tests/helpers/mock_models.js');
MockModels.patch('im_livechat/static/tests/helpers/mock_models.js', T =>
class extends T {
//----------------------------------------------------------------------
// Public
//----------------------------------------------------------------------
/**
* @override
*/
static generateData() {
const data = super.generateData(...arguments);
Object.assign(data, {
'im_livechat.channel': {
fields: {
user_ids: { string: "Operators", type: 'many2many', relation: 'res.users' }
},
records: [],
}
});
Object.assign(data['mail.channel'].fields, {
anonymous_name: { string: "Anonymous Name", type: 'char' },
country_id: { string: "Country", type: 'many2one', relation: 'res.country' },
livechat_active: { string: "Is livechat ongoing?", type: 'boolean', default: false },
livechat_channel_id: { string: "Channel", type: 'many2one', relation: 'im_livechat.channel' },
livechat_operator_id: { string: "Operator", type: 'many2one', relation: 'res.partner' },
});
Object.assign(data['res.users'].fields, {
livechat_username: { string: 'Livechat Username', type: 'string' },
});
return data;
}
}
);
});