Search code examples
sortingdrag-and-dropodookanban

Odoo 10 Kanban View: Ordering Kanban Items vertically with drag and drop


I want to order Kanban Items in Odoo with drag and drop. I have own integer field 'k_order' and used this field for the model _order="k_order".

Kanban Items are displayed(sorted) correctly according to the k_order fields. But when I change the order(vertically), it does not save it. After refreshing the browser , it goes to the old position.

How can I achieve above behavior(sorting)? I have also used widget="handel" for field k_order.

This sorting in tree view works as desired.


Solution

  • Seems that the kanban widget resequencing only works with field sequence, the default sequencing field for odoo models.

    You can see that part here -> module web_kanban

        resequence: function (ids) {
            if ((ids.length <= 1) || !this.relation) {
                return;
            }
            new data.DataSet(this, this.relation).resequence(ids).done(function (r) {
                if (!r) {
                    console.warn('Resequence could not be complete. ' +
                        'Maybe the model does not have a "sequence" field?');
                }
            });
        },
    
        resequence_column: function (col) {
            if (_.indexOf(this.fields_keys, 'sequence') > -1) {
                this.dataset.resequence(col.get_ids());
            }
        },