Help

2

How to show many2many_checkboxes in multiple columns?

Avatar
Anti Nuga

Currently if I change m2m widget to checkboxes, it will show all the possible values in a single column. Is there a way to show them in 2+ columns?

e.g. Normaly they are shown:

 

Tag 1
Tag 2
Tag 3
Tag 4

and I would like them to show 

Tag 1
Tag 3
Tag 2
Tag 4

or 

Tag 1
Tag 2
Tag 3
Tag 4

The order of the Tags doesn't really matter.

Avatar
Discard
2 Answers
2
Best Answer

Hello Anti Nuga,

     here is the way to change look of many2many_checkboxes widget's view from single column to two-column.


You have to change single line in xml file of web module.

    path: web >> static >> src >> xml >> base.xml

     

<t t-name="FieldMany2ManyCheckBoxes">
    <t t-foreach="widget.get('records')" t-as="record">
        <div>
......

to
 
<t t-name="FieldMany2ManyCheckBoxes">
    <t t-foreach="widget.get('records')" t-as="record">
        <div class="col-xs-6">

 

Hope this will help you, Thanks!

Avatar
Discard
2
Best Answer

Hi Anti,

I think there is no ready widget available for the solution which you are looking for.

You can develop your own widget to achieve this thing.

Inside the user form the access right groups are filtered and grouped in checkbox, that example may help you to develop your own widget for Many2many field.

If you develop that new widget than don't forgot to share ;)


Hope this will help.

Regards,

Anil.

Avatar
Discard