odoo15 kanban view doesn't support one2many field

lading_adapter_ids is a one2many field in the module.

Here is code, and all t-out show a blank.

 <t t-foreach="record.lading_adapter_ids.raw_value" t-as="o">
                                        <t t-out="o.name" />
                                         <t t-if="i % 2 != 0" >
                                            <hr />
                                        </t>
                                        <t t-set="i" t-value="1"/>
                                        <i class="fa fa-location-arrow" title="This is the district" />
                                        <t t-out="o.district" />
                                        <br />
                                        <i class="fa fa-building" title="This is company name" />
                                          <t t-out="o.display_name" />
                                        <br />
                                        <i class="fa fa-map-marker" title="This is the address" />
                                          <t t-out="o.eng_address" />
                                         <br />

                                     </t>

Solution 1:

Unfortunately, you can't use those fields.

The function that builds the object containing the formatted record data used in the template, sets the raw_value to a list of ids in the case of one2many and many2many fields

From kanban view documentation:

Each field has two attributes value and raw_value, the former is formatted
according to current user parameters, the latter is the direct value from a read()
(except for date and datetime fields that are formatted according to user’s locale)

By default, fields are replaced by their formatted value, unless the widget attribute is specified, so you can define a new widget, like many2many_tags to change the behavior of the One2many field in kanban views.

If you look in the FieldMany2ManyTags class you will see a special attribute fieldsToFetch used to retrieve the fields used in the rendering context.

To define a new widget, kanban_address based on the value of a One2many field:

  • You need to extend the AbstractWidget
  • Set the fields to retrieve
  • Define a new template
  • Alter the _render function to render the newly created template.
  • And finally, use the new widget in the field tag in the kanban view.

Example:

1- Kanban Widget

/** @odoo-module **/
import field_registry from 'web.field_registry';
import AbstractField from 'web.AbstractField'
import  { qweb as QWeb, _t } from 'web.core';

var FieldKanbanAddress = AbstractField.extend({
    custom_template: "kanban_address",
    supportedFieldTypes: ['one2many', 'many2many'],
    fieldsToFetch: {
        name: {type: 'char'},
        district: {type: 'char'},
        display_name: {type: 'char'},
        eng_address: {type: 'char'},
    },

    _render: function () {
        var elements = this.value ? _.pluck(this.value.data, 'data') : [];
        this.$el.html(QWeb.render(this.custom_template, {elements: elements}));
    },
});

field_registry.add('kanban.kanban_address', FieldKanbanAddress);

2- Custom template

<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
    <t t-name="kanban_address">
        <t t-foreach="elements" t-as="o">
            
        </t>
    </t>
</templates>

3- widget attribute

<field name="move_raw_ids" widget="kanban_address"/>  

4- Specify JS and XML files in the manifest

'assets': {
    'web.assets_backend': [
        
        '{MODULE_NAME}/static/src/js/kanban_address.js',
    ],
    'web.assets_qweb': [
        '{MODULE_NAME}/static/src/xml/kanban_address.xml',
    ],
},