summaryrefslogtreecommitdiff
path: root/addons/im_livechat/static/tests/helpers/mock_models.js
blob: db18e8f776bee64f5ce4c9bdb9d3beb1ac176415 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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;
        }

    }
);

});