odoo-13.0/addons/web/static/tests/helpers/test_utils_create.js
/**
 * create a model from given parameters.
 *
 * @param {Object} params This object will be given to addMockEnvironment, so
 *   any parameters from that method applies
 * @param {Class} params.Model the model class to use
 * @returns {Model}
 */
create a model from given parameters.
@param {Object} params This object will be given to addMockEnvironment, so
any parameters from that method applies
@param {Class} params.Model the model class to use
@returns {Model}
create a model from given parameters . @param { Object } params This object will be given to addMockEnvironment so any parameters from that method applies @param { Class } params . Model the model class to use @returns { Model }
function createModel(params) {
    var widget = new Widget();
    var model = new params.Model(widget);
    testUtilsMock.addMockEnvironment(widget, params);
    model.destroy = function () {
        delete model.destroy;
        widget.destroy();
    };
    return model;
}
function createModel ( params ) { var widget = new Widget ( ) ; var model = new params . Model ( widget ) ; testUtilsMock . addMockEnvironment ( widget , params ) ; model . destroy = function ( ) { delete model . destroy ; widget . destroy ( ) ; } ; return model ; }
create a model from given parameters.
create a model from given parameters .
// override the model's 'destroy' so that it calls 'destroy' on the widget // instead, as the widget is the parent of the model and the mockServer. // remove the override to properly destroy the model when it will be // called the second time (by its parent)