summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic/widget_registry.js
blob: 470127bd12e5f6e9b2e3afe34196112366018840 (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
odoo.define('web.widget_registry', function (require) {
    "use strict";

    // This registry is supposed to contain all custom widgets that will be
    // available in the basic views, with the tag <widget/>.  There are
    // currently no such widget in the web client, but the functionality is
    // certainly useful to be able to cleanly add custom behaviour in basic
    // views (and most notably, the form view)
    //
    // The way custom widgets work is that they register themselves to this
    // registry:
    //
    // widgetRegistry.add('some_name', MyWidget);
    //
    // Then, they are available with the <widget/> tag (in the arch):
    //
    // <widget name="some_name"/>
    //
    // Widgets will be then properly instantiated, rendered and destroyed at the
    // appropriate time, with the current state in second argument.
    //
    // For more examples, look at the tests (grep '<widget' in the test folder)

    var Registry = require('web.Registry');

    return new Registry();
});