LasLabs has released a new Odoo v9 module that provides a Slick Carousel widget to browse One2many image fields. The module can be found on our Github Mirror or in the LasLabs Repo.

This module does not provide functionality to any existing views, but instead provides a widget for use with any One2many attachment field.

Usage

Default usage is on a One2many attachment field, as defined below:

class SlickExample(models.Model):
    _name = 'slick.example'
    _description = 'Slick Example Model'
    image_ids = fields.One2many(
        name='Images',
        comodel_name='ir.attachment',
        inverse_name='res_id',
    )

Assuming the above model, you would use add a Slick Carousel on the image_ids column by using the following field definition in the model’s form view:

<field name="image_ids" widget="one2many_slick_images" options="{}"/>

Options

The widget passes options directly through to Slick, so any setting available to Slick is available to the widget. Additional options specific to Odoo are:

Name Type Default Description
fieldName String datas Field to lookup on relation table. Defaults to datas, which is the data field used in ir.attachment table. This would be used to define a custom attachment model
modelName String ir.attachment Model of attachment relation. This would be used to define a custom attachment model instead of default ir.attachment

Download

The web_widget_slick module can be found on our Github Mirror or in the LasLabs Repo.

Example Implementation

An example module has been created in order to illustrate how to implement this widget from scratch. It can be found on our GitHub Mirror or in the LasLabs Repo.

0