I have this model:
class RouteSheet(models.Model):
_name = 'route.sheet'
_description = 'Route Sheet'
state_id = fields.Many2one(
'route.sheet.state',
string="Estado",
required=True,
default=lambda self: self.env['route.sheet.state'].search([('code', '=', 'draft')], limit=1),
help="Estado de la hoja de ruta"
)
And this kanban view to the model:
<record id="view_route_sheet_kanban" model="ir.ui.view">
<field name="name">route.sheet.kanban</field>
<field name="model">route.sheet</field>
<field name="arch" type="xml">
<kanban default_group_by="state_id" group_create="False" group_delete="False" group_edit="False" records_draggable="False" quick_create="False" class="o_kanban_mobile" sample="1" default_order="data_doc desc">
<field name="state_id" />
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_card oe_kanban_global_click">
<div class="o_kanban_card_content">
<t t-if="record.name.raw_value">
<strong class="o_kanban_record_title oe_partner_heading">
<field name="name"/>
</strong>
</t>
<t t-else="">
<strong class="o_kanban_record_title oe_partner_heading">Sin Nombre</strong>
</t>
</div>
<div class="o_kanban_details">
<div class="o_kanban_item">
<span class="fa fa-truck o_kanban_icon"/>
<t t-if="record.transport_id.raw_value">
<field name="transport_id"/>
</t>
<t t-elif="!record.transport_id.raw_value">
No hay transportista
</t>
</div>
<div class="o_kanban_item">
<span class="fa fa-user o_kanban_icon"/>
<t t-if="record.chofer_id.raw_value">
<field name="chofer_id"/>
</t>
<t t-elif="!record.chofer_id.raw_value">
No hay chofer
</t>
</div>
<div class="o_kanban_item">
<span class="fa fa-car o_kanban_icon"/>
<t t-if="record.vehicle_id.raw_value">
<field name="vehicle_id"/>
</t>
<t t-elif="!record.vehicle_id.raw_value">
No hay vehículo
</t>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
and I have 3 statuses available for registration: "draft", "confirmed", "in_transit", "rendition", "closed" and "cancel". The problem is that in the kanban view only the columns whose status is in a record appear, if there are no records for a status, this status does not appear. For example, I have three records, each with a different status, so only three columns appear instead of six, and the ones that don't appear are the ones that are not related to any record. Is there any solution?
It worked perfectly, thank you very much!