Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Overriding number of items in a Kanban view with a custom module

Timo Talvitie
on 8/8/14, 7:46 AM 1,301 views

I would like to customize the number of items a kanban view shows before the user has to click the 'show more' button. In addons/web_kanban/static/src/js/kanban.js there is the following snippet of code:


instance.web_kanban.KanbanView = instance.web.View.extend({
    template: "KanbanView",

    init: function (parent, dataset, view_id, options) {
        this._super(parent, dataset, view_id, options);
        this.limit = options.limit || 40;

Is there any way I can access the options variable from a custom module and set/override the limit value there?

This post https://www.odoo.com/forum/help-1/question/how-to-show-more-than-40-items-in-kanban-view-25752 provides a solution for setting the number of items, but it involves hardcoding the value in the original js file, but that's a bit tedious to maintain in the long run.


Nico Bustillos
On 12/3/15, 3:27 PM

Indeed, the best option is to create your own js file inside your custom module. Once you do that, this should be the code to override the options for that instance:

    openerp.your_mod = function(instance, local) {
        instance.web_kanban.KanbanView = instance.web_kanban.KanbanView.extend({
            init: function (parent, dataset, view_id, options) {
                if (dataset._model.name == 'your_mod.object') { 
                    options.limit = 12;    //Imposed limit for my particular object
                this._super(parent, dataset, view_id, options);
    instance.web.views.add('kanban_your_mod_limit', 'instance.your_mod.KanbanView');

When I try this code, I get the following error in my browser Console. Any idea how to debug this further? boot.js:195 error: Some modules could not be started Failed modules: ["web.web_client"] Non loaded modules: ["base.apps", "im_odoo_support.OdooSupport", "__job1", "mail.chat_client_action", "mail.ChatComposer", "mail.chat_manager", "mail.Chatter", "mail.systray", "mail.window_manager", "mail_tip.mail_tip", "web.planner", "web_settings_dashboard"]

on 12/4/15, 4:27 AM

I can't really tell. Doesn't seem to be related to the piece of code above. Try posting a separate Question to get a broader attention from all experts. Also, make sure to put as much context as possible (excerpts of code if possible)

Poiesis Consulting SRL, Nico Bustillos
on 12/4/15, 1:42 PM

My kanban view is overloaded by boxes ;) So i need some solution as well ;) In my module which will be used to move whole locations from one place to another i would like to limit the amount of boxes to for example 4 kanban columns. With my over 500 locations i should save a lot of time. Now when I have to refresh it takes a minute before anything appears on the screen :( Once I manage to add a limit of columns it should be much quicker :)

Dr Obx
on 12/8/15, 8:45 AM

The kanban columns (or lanes) are a whole different story I'm afraid. And tackling this via Javascript like the example above could turn out to be much more complicated. As you might notice, there is a prebuilt "options.limit" variable that already does the heavy lifting for the original question here... so it was a matter of overwriting it at some specific point. But I don't think there is such a thing for the number of columns/lanes. Maybe you should simply resort to 'domains' on the server side (python and xml). You could easily specify which 4 locations you want to display in your Window Action xml definition (something like: "[('location_id','in',[3,6,11,20])]"), which would guarantee you that only those 4 columns/lanes will be displayed (assuming your view is grouped by location_id of course). If you want to do something more sophisticated, you could resort to a wizard that somehow will dynamically determine which 4 locations get to be displayed, and call the Window Action via a python return (with the dynamically constructed domain therein)

Poiesis Consulting SRL, Nico Bustillos
on 12/8/15, 3:14 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 8/8/14, 7:46 AM
Seen: 1301 times
Last updated: 12/3/15, 3:37 PM