Kanban view
A kanban view shows records as cards. An addon declares it in a view file with the same shape the reference uses:
a <kanban> root and one card template, <templates><t t-name="card">. No code is needed.
<record id="book_kanban" model="ir.ui.view"> <field name="name">sample_library.book.kanban</field> <field name="model">sample_library.book</field> <field name="arch" type="xml"> <kanban string="Books"> <progressbar field="book_format" colors='{"hardcover": "success", "paperback": "info", "ebook": "warning"}'/> <templates> <t t-name="card"> <main> <field name="title"/> <field name="author_id"/> <field name="website" widget="url"/> </main> <aside> <field name="title"/> </aside> <footer> <field name="genre_ids" widget="many2many_tags"/> <field name="rating" widget="priority"/> <field name="favorite" widget="boolean_favorite"/> </footer> </t> </templates> </kanban> </field></record>The addon’s manifest must list web in depends: kanban is owned by web.
The card
Section titled “The card”A card is a declaration, not free markup. It holds <field> nodes and at most one each of three regions, in any order:
| Region | What the client does with it |
|---|---|
fields directly in the card, or <main> | the first field is the card’s title; the others are lines under it |
<aside> | the leading tile. Image fields are not available yet (ADR 0089 is Proposed), so put a character field here: the card shows an initials tile from its value. When images exist, the image widget goes here without a syntax change. |
<footer> | the bottom row: tags, priority stars, a favourite flag, counters |
Each card field is an ordinary field node: any registered widget (the ones forms and lists use) and its options, a
string, a static invisible and groups. A many2many without a widget is shown as tags.
In the client
Section titled “In the client”Add kanban to the window action’s view_mode (the sample library’s Books action has list,kanban,form,pivot) and the view
switcher shows a Kanban button. The client draws the cards ungrouped, one page at a time (limit, else 40), through
web_search_read with the card fields. Each card field is drawn by the field widget its widget names, read-only, looked up first
under the card.<widget> key of the field widget registry, so an addon can register a card-specific variant (for example
card.priority) without changing forms or lists; card.dashboard_card draws a whole application overview card with buttons,
figures and a chart from one computed field (Dashboard cards). A field with a static invisible="1" is read but not drawn. A card opens its
record when the arch allows it (can_open) and the action has a form view.
Grouped columns, drag and drop, quick creation and the drawing of the progress bar are not available yet. A view with
default_group_by is shown ungrouped with a sentence that says so.
Root attributes
Section titled “Root attributes”| Attribute | Meaning (default) |
|---|---|
limit | cards per page, a positive whole number (the list’s page size when absent) |
default_group_by | one stored boolean, char, integer, selection, many2one, date or datetime field the board opens grouped by. A user who cannot read that field gets the cards ungrouped. |
quick_create | inline creation in a column (true; always false when create="0") |
records_draggable, groups_draggable | cards and columns may be dragged (true) |
archivable | column records may be archived (true) |
can_open | a click on a card opens its record (true) |
create, edit, delete | as on a list |
Progress bar
Section titled “Progress bar”<progressbar field colors sum_field help>, at most one, directly under <kanban>: field is a selection or char field;
colors is a literal dictionary from a value of that field to one of success, warning, danger, info or muted
(for a selection, every key must be one of its values; at most 64 entries, no key twice); sum_field is an integer, float or
monetary field summed per column; help is a short text. The bar is drawn on grouped columns. A user who cannot read
field or sum_field gets the view without the bar.
What is refused
Section titled “What is refused”Installation fails with a message that names the element or attribute; nothing is silently ignored.
| Declared | Result |
|---|---|
markup in the card (<div>, <span>, <a>, <img>, <widget>), t-if, t-att-*, t-esc, or a template other than card | refused: free template markup needs the restricted template compiler, which is not available yet |
class or any other unlisted attribute on a card node | refused by name |
a <field> directly under <kanban> (the reference loads such fields for template expressions) | refused: declare it inside the card |
no card, two cards, a card outside <templates>, a region twice, two progress bars | refused |
a dynamic invisible on a card field (invisible="not email") | refused: per-card modifiers are not available yet |
| a one2many field on a card | refused |
default_group_by with several fields, an unknown field, or a float, text, many2many or one2many field | refused |
group_create, group_delete, group_edit, on_create, quick_create_view, highlight_color, default_order, sample, examples, <header>, <control> | refused by name: each comes with the slice that uses it |
Server calls
Section titled “Server calls”The view adds no method: cards load through web_search_read (ungrouped) and web_read_group (grouped), the bar through
read_progress_bar, quick creation through name_create, reordering through web_resequence. Each is the ordinary ORM
method with its access checks. A dashboard card opens its actions through erp_load_web_action_ref
(Dashboard cards).