Skip to Content
Menu
This question has been flagged

I have a one2many line and contains many2many fields of widget type many2may_tags. So in my view, I need to make invisible according to a  many2one field using the attrs-{'invisible': Domain}. What happening is the field becomes invisible and the field name remains there. Whether guys you have any solution to make invisible the field name and its space too?


This is my structure:-


<field name="One2manyfield">
<tree>
<field name="many2one_field"/>
<field name="many2manyfield" widget="many2many_tags" attrs="{'invisible': [('many2one_field', '=', one of values in many2one model)]}"/>
</tree>
</field>
Note: - In case of  a list We can't make invisible column where this is needed for next lines. My case is List is limited to size 1

Avatar
Discard
Best Answer

Hello, 

basically, the issue is not how to make m2m invisible, but how to make a definite cell in one2many field invisible.

You can't achieve it using attrs and domain. Sincerely speaking, I think you can't achieve it using standard Odoo tools. I guess, you should apply some sort of js picturing.

You may make a whole column invisible, but not using attrs. To this end 'context' should be passed:

<field name="many2manyfield" widget="many2many_tags" invisible="context.get('some_parameter')"/>
Avatar
Discard
Author

You can't make an invisible column with your code, but you can make the column in a list record, That what my code also doing. Just try with attrs and you can see the column in the list will be hidden according to the condition. The case is you can hide the label from the labels rows and it still remains there. why? Simply ie, needed for next records in the list.

Next what I need to achieve is "My list will only have one record" ! So the label of the column is not needed in case of making invisible. Through js we can

Related Posts Replies Views Activity
0
Apr 21
4370
2
Sep 19
5002
3
Jul 19
5633
2
Mar 15
7898
7
Jul 18
19401