Thakur
Thakur

Reputation: 2020

Add Multiselect dropdown in Odoo module

I want to add a multiselect dropdown in Odoo module Field name will be Weekly Holiday which will be use to select multiple days of week

Below python is code i tried. 'weeklyholiday': fields.selection([('Sunday', 'Sunday'), ('Monday', 'Monday'), ('Tuesday', 'Tuesday'),('Wednesday', 'Wednesday'),], "Weekly Holiday"),

Upvotes: 3

Views: 7982

Answers (1)

Alessandro Ruffolo
Alessandro Ruffolo

Reputation: 1575

AFAIK you can't have multiselection, unless you use some external field type. I suggest you instead to change your field in a many2many:

weeklyholiday = fields.Many2many('weekday')

with the following declaration in the view, you should be able to accomplish your need.

<field name="weeklyholiday" widget="many2many_tags" options="{'no_create_edit':'1'}"/>

Upvotes: 4

Related Questions