summaryrefslogtreecommitdiff
path: root/addons/website_livechat/static/tests/helpers/mock_models.js
blob: bc4079596f8796618e0d63b18c61139fb564dba4 (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
43
44
45
odoo.define('website_livechat/static/tests/helpers/mock_models.js', function (require) {
'use strict';

const MockModels = require('mail/static/tests/helpers/mock_models.js');

MockModels.patch('website_livechat/static/tests/helpers/mock_models.js', T =>
    class extends T {

        //----------------------------------------------------------------------
        // Public
        //----------------------------------------------------------------------

        /**
         * @override
         */
        static generateData() {
            const data = super.generateData(...arguments);
            Object.assign(data, {
                'website.visitor': {
                    fields: {
                        country_id: { string: "Country", type: 'many2one', relation: 'res.country' },
                        display_name: { string: "Display name", type: 'string' },
                        // Represent the browsing history of the visitor as a string.
                        // To ease testing this allows tests to set it directly instead
                        // of implementing the computation made on server.
                        // This should normally not be a field.
                        history: { string: "History", type: 'string'},
                        is_connected: { string: "Is connected", type: 'boolean' },
                        lang: { string: "Language", type: 'string'},
                        partner_id: {string: "partner", type: "many2one", relation: 'res.partner'},
                        website: { string: "Website", type: 'string' },
                    },
                    records: [],
                },
            });
            Object.assign(data['mail.channel'].fields, {
                livechat_visitor_id: { string: "Visitor", type: 'many2one', relation: 'website.visitor' },
            });
            return data;
        }

    }
);

});