This question has been flagged
1 Reply
4225 Views

I am trying to add a field in the document's kanban view. It displays the label only not the value.

Here is the code.

document_kanban_inspector_inherit.js


_renderFields: function () {

        var options = {mode: 'edit'};

        if (this.records.length === 1) {

            this._renderField('name', options);

            this._renderField('barcode', {

                icon: 'fa fa-barcode',

                mode: 'edit',

            });

            if (this.records[0].data.type === 'url') {

                this._renderField('url', options);

            }

            this._renderField('partner_id', options);

        }

        if (this.records.length > 0) {

            this._renderField('owner_id', options);



            this._renderField('folder_id', {

                icon: 'fa fa-folder o_documents_folder_color',

                mode: 'edit',

            });

        }

    },




How can i do this?

Avatar
Discard

Did you get this work by any chance?

Best Answer

I know this is an old question, but for whoever might at some point search for this, here is an answer: you also have to load the fields in the kanban view of documents.document for that field to show on the document inspector. Here is the code i used to load the field building_id:



odoo.define('xxx.DocumentsKanbanView', function (require) {
"use strict";
const DocumentsKanbanView = require("documents.DocumentsKanbanView");

DocumentsKanbanView.include({
init: function () {
this._super.apply(this, arguments);
const fields = ['building_id'];
debugger
_
.defaults(this.fieldsInfo[this.viewType], _.pick(this.fields, fields));
}
});
});


Avatar
Discard