How it works...

We need to give a list of fields to load in step 2 in order to be able to access them later. The content of the templates element must be a single t element with the t-name attribute set to kanban-box.

What you write inside this element will be repeated for each record, with special semantics for t elements and t-* attributes. For details about that, refer to the Using client-side QWeb templates recipe from Chapter 15, Web Client Development, because technically kanban views are just an application of QWeb templates.

There are a few modifications that are particular to kanban views. You have access to the read_only_mode, record, and widget variables during evaluation. Fields can be accessed using record.fieldname, which is an object with the value and raw_value properties, where value is the field's value that has been formatted in a way that is presentable to the user, and raw_value is the field's value as it comes from the database.

Many2many fields make an exception here. You'll only get an ID list through the record variable. For a user-readable representation, you must use the field element.

Note the type attribute of the link at the top of the template. This attribute makes Odoo generate a link that opens the record in view mode (open) or edit mode (edit), or it deletes the record (delete). The type attribute can also be object or action, which will render links that call a function of the model or an action. In both cases, you need to supplement the attributes for buttons in form views, as outlined in the Adding buttons to forms recipe of this chapter. Instead of the a element, you can also use the button element; the type attribute has the same semantics there.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset