When adding an invisible rule based on domain in backend Form View (specifically in Settings in my case), the "not ilike" operator is throwing an error, stating it is unsupported.
<div attrs="{'invisible': [('char_field', 'not ilike', 'tested text')]}">
This should not appear if char_field doesn't contain "tested text".
Instead, error is thrown when form is being loaded.
</div>
causes a javascript error:
Error: While parsing modifiers for div: for modifier "invisible": Domain char_field,not ilike,tested text uses an unsupported operator
However, this works:
<div attrs="{'invisible': [('char_field', 'ilike', 'tested text')]}"></div>
This will not appear if char_field contains "tested text".
Any idea how to write the domain to reach the intended result (show a block only if specific text is present in the Char field)? Is an extra computed field the only way?
It seems to be similar or same as this 11.0 - 13.0 issue: https://github.com/odoo/odoo/issues/41051
Have you tried to use other operators to check if it is only 'not ilike' that is not working?
@apiuser I don't think this will shed new light on the problem, but here goes - from operators that seem meaningful from text, not working:
not ilike
not like
Working:
ilike
like
=
!=
As I don't have enough karma, I can only comment here. This comment is for the answer you suggested.
I am certain I did not miss any argument - other operators work. This domain works in Python in other parts of my code.
I cannot find any difference between your formatting and mine, other than that you added a comma after the first tuple in the list. That shouldn't make any functional difference.
I'm almost sure this is a shortcoming of Odoo's javascript code for evaluating domain expressions - they seem to have skipped development of "not like" and "not ilike".
Could it be that you missed an argument? I'm using python and the syntax I use is like that:
I think you cannot help if you won't try with view - this is an issue of the javascript part of Odoo that parses views. Try adding a Char field to any form view and then some div or field or whatever and add an attr attribute to it, using the domain as I outlined in the original post. You'll see the module upgrades, but when you open the view, a javascript error will pop up if you use "not like" or "not ilike" operator.
To illustrate the issue, I have manually edited the "project.task.form" view in the newest runbot, should stay up for couple of hours. If you open any task in Field Service, you'll see the error.
View: https://17497904-14-0-all.runbot83.odoo.com/web?debug=1#id=1992&action=28&model=ir.ui.view&view_type=form&cids=1&menu_id=4
Task: https://17497904-14-0-all.runbot83.odoo.com/web?debug=1#action=1228&cids=1&id=41&menu_id=874&model=project.task&view_type=form
If already garbage collected, steps to reproduce:
1. log in as admin
2. turn debug mode on
3. Go to Field Service, open any task to see it loads
4. go to Settings / Technical / User Interface / Views
5. search "project.task.form
6. edit, in architecture, add to the header tag (line 11) attribute attrs="{'invisible': [('name', 'not ilike', 'tested text')]}"
7. Go to Field Service, open any task - you'll see the problem.