There's more...

If you don't want to introduce the new view type and you just want to modify a few things in the view instead, you can use js_class on the view. For example, if we want a view similar to the kanban one that we created, then we can extend it as follows:

var CustomRenderer = KanbanRenderer.extend({
...
});

var CustomRendererModel = KanbanModel.extend({
...
});

var CustomRendererController = KanbanController.extend({
...
});

var CustomDashboardView = KanbanView.extend({
config: _.extend({}, KanbanView.prototype.config, {
Model: CustomDashboardModel,
Renderer: CustomDashboardRenderer,
Controller: CustomDashboardController,
}),
});

var viewRegistry = require('web.view_registry');
viewRegistry.add('my_custom_view', CustomDashboardView);

We can then use the kanban view with js_class (note that the server still thinks of this as a kanban view):

...
<field name="arch" type="xml">
<kanban js_class="my_custom_view">
...
</kanban>
</field>
...
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset