odooodoo-10one2many

Odoo 10 - How to hide a One2many field


I have a One2many field, and against the attrs I want to put something along the lines of - if this One2many is blank then hide it.

The One2many is already auto populated from other objects, so all I need to do is set the invisible to something like...

{'invisible':[('this_field_ids','=',False)]}

There is only one problem... this does not work for a One2many field.

If it was a boolean, char, or Many2one then it would work, but the One2many acts differently.

What can I put in the attrs to make this (or in this case, the 'page' that this is within) invisible if it is empty?

I believe that I can make a separate computed field to get the job done, but I wanted to know if I can achieve this without the computed field.


Solution

  • The comparaison should be with an empty list:

    {'invisible':[('this_field_ids', '=', [])]}