Commit Graph
25 Commits
Author SHA1 Message Date
Julien Mougenot 9bf7d15da4 [FIX] web: allow filtering with decimals on price filter + unit test
Issue

	- Install "Sales"
	- Switch to "German" language
	- Go to Sales -> Products -> Products
	- Try to filter on "Public Price" is equal to "2,3"

	Not possible to add decimal point at the end (only in middle of number).

Cause

	In case the 'decimal point' in DB params is not a dot '.',
	the filter input will be considered as 'text' instead of
	'number'.

	In case of the 'number' type; HTML do already a pre and post
	processing, including managing decimal point (who, for example,
	is not included in ev.target.value if last char is a '.').
	Unfortunalty, the library is not well working with other
	language and not supported on every browser, therefore,
	must use own logic.

	In case of a 'text' type, the value will be send to 'parseFloat'
	,then `parseNumber` will replace decimal_point by dot (also one the
	issues since needed to display decimal_point according user language),
	and `Number` will remove the decimal_point in case of '123,' -> '123',
	and therefore we will not be able to write decimals ( apart of adding
	the decimal point after writing the whole number...)

Solution

	If user input is well parsed, store parsed value in condition.value and
	set condition.displayedValue to the input value (an so without updating
	input value). Else, replace input value with previous value (who should
	be the condition.DisplayedValue).

opw-2463441

closes odoo/odoo#67978

X-original-commit: e795ce5bff14b6b748c1f4a2651946aafdc299f4
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
2021-03-16 16:02:07 +00:00
Francois (fge)andSimon Genin d29666c04c [IMP] web, *: adapt some JS files to new module system
The previous work on adding support for native JS modules needs to adapt
some existing files, which have an incompatible name (with a '/').

Also, we convert a few JS file in /web to the native JS module system,
to show that it can work.

Part of PR 63177

Co-authored-by: Simon Genin (ges) <ges@odoo.com>
2021-02-15 10:18:11 +01:00
Mathieu Duckerts-Antoine 862b21f156 [FIX] web: boolean field autocompletion with 'No'
Before this commit, select the "No" option of a boolean field in the
search bar autocompletion menu would crash.

closes odoo/odoo#66058

X-original-commit: ad5d642c455d3215857f25e0d69c593324178d29
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-02-12 12:02:43 +00:00
Aaron Bohy a890b0bf03 [FIX] web: keep null/false/true strings in domains
Before this commit, occurences of 'null', 'true' and 'false'
strings as autocomplete values in the search view were replaced
respectively by None, True and False.

Fixes #65743

closes odoo/odoo#65958

X-original-commit: 885932ae8e31905e08b79141a445933b6afc9f15
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-02-11 12:18:25 +00:00
Nicolas Lempereur 795c6723df [FIX] web: use latin number date domain in comparison menu
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 #61354

closes odoo/odoo#61443

X-original-commit: 74ea66a107cfc98cce8e52903ec21e3d752fb4fb
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-11-05 17:44:49 +00:00
Paul Morelle def4f727b7 [FIX] web: load_filters in search dialogs
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

closes odoo/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>
2020-10-06 07:43:04 +00:00
Bruno Boi cd8686f5f8 [IMP] web: default custom OR filter to previous
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.

closes odoo/odoo#56918

Taskid: 2222545
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-09-17 07:51:18 +00:00
Hardik Prajapati a080882fb1 [FIX] web: remove uppercase under Favorites
this commit removes unnecessary uppercase used under the favorites menu

task - 2325684

X-original-commit: 3dcab1845001c4dbf1161fb38c540cb0184d35b8
2020-09-09 07:30:46 +00:00
Mathieu Duckerts-AntoineandJulien Mougenot dc8973fd6e [FIX] web: default operators for search fields
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.

closes odoo/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>
2020-07-31 08:04:57 +00:00
Julien Mougenot a7657fbf84 [IMP] web: Drop widget support in search view
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
2020-07-27 08:03:18 +00:00
Julien MougenotandMathieu Duckerts-Antoine d3dd7b24b0 [IMP] *: adapt tests to Owl search panel
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>
2020-07-23 08:21:10 +00:00
Xavier ALT 2479da0176 [FIX] web: do no try to render filters referencing access restricted fields
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

closes odoo/odoo#54112

X-original-commit: b3452a1863c36290b13e16161e2703d9a3737f0e
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-07-06 09:40:09 +00:00
Julien Mougenot ff6263dd3f [FIX] web: Support widgets in search view
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

closes odoo/odoo#54066

X-original-commit: f33b0bc7a93e60bd0ed00b40d7459225ec0b749a
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2020-07-03 15:48:42 +00:00
Julien Mougenot c96de07f85 [FIX] web: Allow default favorite filter over search default
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.

closes odoo/odoo#53840

X-original-commit: ff834d0ba6f9b7eadc23c28dbbf892eba2058583
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-06-30 07:22:12 +00:00
Xavier ALT 19033e804e [FIX] web: in search view, use modifiers to determine if filter is invisible
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="{&quot;invisible&quot;: false}"/>
   ...
</search>
```

After this commit, the filter "myfilter" will correctly be shown.

OPW-2243639

closes odoo/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>
2020-06-25 15:01:29 +00:00
Aaron Bohy b4ba0fc340 [FIX] *: adapt tests to env rework
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.
2020-06-12 09:47:48 +00:00
Julien Mougenot c4786fccfd [IMP] *: update notifications to optional title
closes odoo/odoo#52826

Related: odoo/enterprise#11084
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-06-12 09:01:50 +00:00
Mathieu Duckerts-AntoineandJulien Mougenot 087724fa9e [IMP] *: adapt tests to comparison menu
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>
2020-06-04 19:32:52 +00:00
Mohammed Shekha c28244e4b2 [FIX] web: do not use groupbys in views not groupable
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.

closes odoo/odoo#51041

X-original-commit: 91c80291e90127792623476d8997fd2a67569170
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2020-05-11 13:40:10 +00:00
Julien Mougenot 6fc3bee255 [FIX] web: search many2one fields with correct value
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

closes odoo/odoo#50410

X-original-commit: bac74010daae868da474de9439bc7027d9206e38
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2020-04-29 15:30:27 +00:00
Julien Mougenot f50c3298bb [FIX] web: set selection fields' default value in custom filters
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.

closes odoo/odoo#49772

X-original-commit: 62b62570725bc8eb3d3fa77fd1e8efd7a4fb5d2b
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2020-04-20 09:28:21 +00:00
Julien Mougenot e1f9648021 [FIX] web: empty search bar value on autocomplete close
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

closes odoo/odoo#49066

X-original-commit: 1c3e6ef0a5946ce415c9a210546b207011a51b3d
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2020-04-06 13:38:45 +00:00
Dhruv Patel 8b6592e4d4 [IMP] web: add test for text paste in searchbar
added test case for text paste in autocomplete in the searchbar using mouse,
it should populate the autocomplete dropdown.

task-2204174

closes odoo/odoo#48251

X-original-commit: 010961ee3eac55a1e885ce918b597943078324f6
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-25 11:55:20 +00:00
Mathieu Duckerts-Antoine 1959e7756a [FIX] web: do not activate falsy search defaults
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.

closes odoo/odoo#47958

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-20 08:06:41 +00:00
Julien MougenotandMathieu Duckerts-Antoine bb8eb766a8 [REF] web: Control panel tests
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>
2020-03-13 14:08:33 +00:00