When using eg. arabic locale, the figures inside dates were replaced by
arabic figures which are not supported server side (they are almost
always sent in latin figures).
With this changeset, the we are using english locale to get date in
domains.
Without the change, added test fails with:
Numbers in domain should not use addoneForTest locale
Expected:...[date_field, >=, 2020-06-01], [date_field, <=, 2020-06-30]
Result:...[date_field, >=, 3131-17-12], [date_field, <=, 3131-17-41]
opw-2370392
closes#61354closesodoo/odoo#61443
X-original-commit: 74ea66a107cfc98cce8e52903ec21e3d752fb4fb
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Since fbf347498f, when opening a view in a
dialog, the favorite filters were not loaded.
For example on the runbot:
1. In CRM, open any lead, edit it, and open the Customer dropdown
2. Create a custom filter, save it as favorite, and close the dialog
3. Open the dialog again: you don't see your new filter
With this commit, you will see your filter at step nr. 3
closesodoo/odoo#59186
X-original-commit: 418013e8dbb2aa2d4ffd4f650f080ca5a94183f9
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Paul Morelle <madprog@users.noreply.github.com>
When one constucts a custom filter in the search view and clicks
on the "ADD A CONDITION" button, the new condition dropdowns always
start with the top of the lists.
This commit will instead default a new condition to the same field and
operator as the previous one.
Presetting the dropdowns used in the previous condition is a better
guess for what a user tries to filter than starting the dropdowns each
time at the top of their lists.
closesodoo/odoo#56918
Taskid: 2222545
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
During the refactoring of the control panel (https://github.com/odoo/odoo/pull/41268)
a regression concerning the operator used for the fields set as
search_default was introduced: the default operator was fixed to '='
while it would have been necessary to take into consideration the
optional 'operator' attribute or the field types. Moreover, the default
operator associated to many2one fields when using autocompletion was
also mistakenly set to 'ilike' instead of '='. The present commit
restores the previous behavior.
closesodoo/odoo#55099
X-original-commit: 1f8e93fc590a6c7ef6b93953058f2dcd643ac620
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Until now the "widget" attribute used in the search view was meant to
force the type of a field regardless of its definition. This system was
implemented quite a long time ago and is now useful in only one case:
searching for "reference" fields (we want them considered as char fields
else it is impossible to search on them).
This is why this commit completely removes the "widget" attribute
support in search views while consistently casting the "reference"
fields as "char" fields in the search bar.
Task 2061795
Adaptation of the tests to the changes regarding the refactored search
panel and model.
Part of task 2228968
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
In case a field is limited to specific groups on the model, those fields
are discarded from `fields_view_get()` but can still be referenced by some
filters on the search view causing a traceback (see #53797)
Model:
```python
class MyModel(models.Model):
my_field = fields.Char(groups='base.group_system')
```
Search views:
```xml
<search string="My Model">
<filter name="group_myfield" context="{'group_by': 'my_field'}"/>
</search>
```
This commit ensure those filter are correctly discarded.
OPW-2284621
closesodoo/odoo#54112
X-original-commit: b3452a1863c36290b13e16161e2703d9a3737f0e
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Since the refactor of the control panel, support of "widgets" attributes
in the search view archs has been inadvertently dropped.
Now, they are once again supported.
Task 2061795
closesodoo/odoo#54066
X-original-commit: f33b0bc7a93e60bd0ed00b40d7459225ec0b749a
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Before this commit, when a search_default on a many2one field tried to
update its label after a name_get, the value was set on its initial
associated query element which could have been erased by a default
favorite.
Now, the model determines whether there is a default favorite before
processing default filters, preventing any unnecessary RPC.
closesodoo/odoo#53840
X-original-commit: ff834d0ba6f9b7eadc23c28dbbf892eba2058583
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
In search view, the "invisible" attribute can use complex expression,
and so we must rely on the "modifiers" attribute set by the ir.ui.view
post-processing to determine if a filter should be invisible or not.
For example, considering the context {'hide_myfilter': False}, the
following view:
```xml
<search>
...
<filter name="myfilter" string="My Filter" invisible="context.get('hide_myfilter')"/>
...
</search>
```
Will be returned as such by the server:
```xml
<search>
...
<filter name="myfilter" string="My Filter" invisible="context.get('hide_myfilter')"
modifiers="{"invisible": false}"/>
...
</search>
```
After this commit, the filter "myfilter" will correctly be shown.
OPW-2243639
closesodoo/odoo#53690
X-original-commit: 00969326e24dadd9b3f6e026789a1e575dd1c8dc
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Xavier ALT <xavieralt@users.noreply.github.com>
This commit adapts tests following recent changes on the helpers.
The main change is that addMockEnvironment (and all functions using
it) are now async, as they need to wait for services to be started.
Tests have been adapted accross all affected modules to support the new
"comparison" menu component.
Task ID: 2245719
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Before this commit: A problem occurs with kanban views that are not
groupable (i.e. for which searchMenuTypes does not contain 'groupBy'):
if the action has a default groupby (set in Studio for instance) then
it is still applied and causes crashes. That happens in the documents
kanban view for instance.
More generally, if a view is not groupable, some information on groupbys
can appear in the interface (in a facet) while not used/useful
for the view.
After this commit:
- if a kanban view is not groupable, a default groupby will never be
applied.
- if a view is not groupable, we ensures that
- the search query generated in the control panel has
groupBy = [],
- groupbys cannot be represented in a facet.
closesodoo/odoo#51041
X-original-commit: 91c80291e90127792623476d8997fd2a67569170
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
Before this commit, searching a many2one field in the search bar would create a
domain with a parsed version of the input string. However the parser of m2o fields
returns a number (ID) and would consistently return 'NaN'.
Now, raw values are taken as is when searching with many2one fields.
Task 2239254
closesodoo/odoo#50410
X-original-commit: bac74010daae868da474de9439bc7027d9206e38
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Before this commit, the 'selection' fields were treated like 'char' fields in the
"Add Custom Filter" menu of the control panel's filter menu. This meant that their
value was defaulted to "".
Now, the default value of a selection field is its first selection value.
closesodoo/odoo#49772
X-original-commit: 62b62570725bc8eb3d3fa77fd1e8efd7a4fb5d2b
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Before this commit, the value of the search bar remained when the auto-completion
dropdown was closed (via click out or "Escape"). This was inconsistent with the
behaviour of the search bar which is supposed to show the auto-completion values
related to the search input.
Now, the value is cleared when the dropdown closes.
Task 2227590
closesodoo/odoo#49066
X-original-commit: 1c3e6ef0a5946ce415c9a210546b207011a51b3d
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
added test case for text paste in autocomplete in the searchbar using mouse,
it should populate the autocomplete dropdown.
task-2204174
closesodoo/odoo#48251
X-original-commit: 010961ee3eac55a1e885ce918b597943078324f6
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, if an action context would contain a key/value pair
like
search_default_foo : 0
the filter foo would be activated, while it should be not considered
as default.
The present commit fixes that situation.
closesodoo/odoo#47958
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Use of the new helpers in control panel (and subcomponents) tests and addition
of new tests.
Part of task 2196029
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>