Commit Graph
11 Commits
Author SHA1 Message Date
Bruno Boi ab3032465c [FIX] web: invalid date/datetime value/range/domain in mockReadGroup
The mock server's mockReadGroup function would not properly compute the
value, range and domain of the returned groups for date/datetime fields.
The value should be expressed in the local timezone,
and the range/domain shoulb be expressed in UTC timezone.

Consider the following:
- a record with a datetime field of value "2016-12-14 12:34:56" (expressed in UTC)
- a user with an UTC+2 timezone offset
- a read_group with groupby "['datetime:hour']"

The corresponding group would have had the following metadata:
- value: `"12:00 14 Dec"`
- domain: `[["datetime", ">=", "2022-12-14 11:00:00"], ["datetime", "<", "2022-12-14 12:00:00"]]`
- range: `{ from: "2022-12-14 11:00:00", to: "2022-12-14 12:00:00" }`

It now has the following valid metadata:
- value: `"13:00 14 Dec"`
- domain: `[["datetime", ">=", "2022-12-14 12:00:00"], ["datetime", "<", "2022-12-14 13:00:00"]]`
- range: `{ from: "2022-12-14 12:00:00", to: "2022-12-14 13:00:00" }`

closes odoo/odoo#96946

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-02 09:19:57 +02:00
Jorge Pinna Puissant 52509f04eb [FIX] web: take into account invisible buttons
Before this commit, an error was raised when an invisible button was
found on a list view (for example, if it has a group).

Now, the invisible buttons are correctly managed.

closes odoo/odoo#96963

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-01 10:55:40 +02:00
Mathieu Duckerts-Antoine dcbf2119fc [FIX] web: kanban: problem with date/datetime granularity
The call to web_read_group done in _loadGroups was incorrect when the first groupby
was of the form date_field:granularity (e.g. "create_date:day"). The groupby was
sent as a mesure and interpreded as such, leading to an error of the form
"Invalid aggregation function ...".
This was not detected before by lack of manual testing: the mock server used in tests
checks the read group parameters in a different way from what is done server side.
So the error was not visible in the testing environment.

In this commit, we remove the error in web_read_group and improve the mock server
(a bit) so as to make such errors be detected.

Part-of: odoo/odoo#92475
2022-06-30 09:29:47 +02:00
Lucas Lefèvre 89f9b12d99 [FIX] web: mock search_count returning 0
The mock implementation of search_count returns `false` instead of 0 when the
domain doesn't match any records.

Also, writing some tests revealed the `active_test` context key was not taken
into account.

closes odoo/odoo#93746

Related: odoo/enterprise#28449
Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-06-16 16:03:36 +02:00
Aaron Bohy 4f884b1c37 [REF] web: merge mock server tests into one file
Also lint the mock_server file.

closes odoo/odoo#92539

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-06-01 08:51:50 +02:00
Rémi RahirandLucas Lefèvre d090d449d5 [FIX] web: mocked name_get should return "" instead of "False"
Since 43474916 and ff37a2fe, the function `name_get` now returns an
empty string for missing records. This change was not reflected in
mockServer.

This commit also copies the tests of `name_get` on  the legacy mockServer
to the "new" one. They were missing.

closes odoo/odoo#92473

X-original-commit: 638fab65cdf7a615138dee1395f54224b3ea1e77
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Co-authored-by: Lucas Lefèvre <lul@odoo.com>
2022-05-31 10:04:17 +02:00
Julien Mougenot f6b051a828 [IMP] web,*: Deterministic mock server sorting
This commit orders the records coming from the mock server the same
way they are ordered by the ORM, while also allowing it to support
multiple levels of orderby.

This has been done to increase consistency in the test suite and provide
a more accurate representation of how records would be returned by the
actual server.

Some tests performed their assertions based on this previous
undeterministic system and have been adapted, either by altering
the base setup or the assertions themselves.

closes odoo/odoo#84718

Related: odoo/enterprise#24509
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-02-18 15:30:39 +00:00
FrancoisGe 5801ff87cf [FIX] web: MockServer search
The mockSearch function should not return the list of records for a
domain and a model but the list of ids.

The path "/web/dataset/search" does not exist.

closes odoo/odoo#80835

X-original-commit: 5f6d72e43eaec803eea76927433706dfd5e2be73
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-12-03 12:05:59 +00:00
Bruno BoiandMohammed Shekha 6957a614d2 [IMP] web: test coverage for many2many grouping
Add testing coverage for m2m grouping feature introduced by cbc9f3c

Linked PR: odoo/odoo#74985

task-2633123

X-original-commit: a6296f8952b27c597d017332e865d5ca1bd0adac
Part-of: odoo/odoo#76493
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2021-09-14 15:10:14 +00:00
Jorge Pinna Puissant a81ba713ff [FIX] web: parse and format dates of mock server
On 00e3cb74c4 the migration of the code to
parse and formate dates on the mock server from moment to luxon was
done. Two issues were introduced on that commit: Parsing a date
displayed on quarter wasn't possible; And the ISO week year wasn't used
to format the date, but it was used to parse the date, for symmetry's
sake, now the ISO week year is used on both.

closes odoo/odoo#75354

Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
2021-08-23 08:08:38 +00:00
Pierre Rousseau 21cafb0cee [FIX] web: mock active_test for search and search_read
The support for "active_test" context key was ignored in "search" and
"search_read" methods. See https://github.com/odoo/odoo/commit/bf0e3403098a9a36cb7c818388ccca1ea87682bd

closes odoo/odoo#75058

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2021-08-13 06:30:40 +00:00