Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
5 Відповіді
18873 Переглядів

Hello, i've done many researches but i can't find anything on how to use this domain filter.

I would like to show, in my tree view, the records that only has a field 'fieldO2M' not empty.

For now, I find this incredibly hard to understand how domain works. I tried several things, the only one that went close to my goal was :

 

 attrs="{'invisible' :[('fieldO2M', '=', [])]}" as a field attribute

This one works but doesn't do what i want, it make the value of the field on which it is applied disappear. I want the all line to not be shown just like if i had used filter --> "fieldO2M" is defined.

After this I tried a lot of things that looks like this :

<field name="fieldO2M" domain="[(....."

But nothing that works or actually do something on my view.
Can someone explains me how the domain attribute works and how can I achieve my goal ?

I know that the domain definition is [('field','operation',value)] but i don't understand how to apply it to a field.

Thank you in advance ! :)

Аватар
Відмінити
Автор

My goal is to create a filter that can't be exited. The filter I made :

<filter string="Matchings" name="filter_matchings" domain="[('fieldO2M', '!=', '[]')]"/>

Найкраща відповідь

Hi,

You can use domains on action view

<record model="ir.actions.act_window" id="action_id">
            <field name="name">action name</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">your model</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="search_view_id" ref="search_id" />
            <field name="domain">[('fieldO2M','!=',[])]</field>
        </record>

Best regards

Аватар
Відмінити
Автор

Thank you ! I was using ir.actions.act_window.VIEW so i tried to put the domain in theses view actions. It has to be in the master Action Window to be effective. Thank you again !

Happy to help :)

Найкраща відповідь

Try:

domain="[('fieldO2M', '=', True)]"
Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
0
лют. 25
18
2
бер. 15
6965
1
бер. 15
3840
0
бер. 15
3839
3
трав. 24
5518