The previous commit has as a side effect to change the value returned by
the create method of the orm service. Here we adapt the code that uses it
and make the test pass.
Part-of: odoo/odoo#111965
Let us have records with values 1, 0, 77, 3 for a float field 'foo'.
read_group allows to get those values in an array with the aggregate
function array_agg:
read_group([], ["foo:array_agg", ...], []) will return
[{ __count: 4, foo: [1, 0, 77, 3], ... }]
We now support the use of array_agg for integer and float fields in
the mock server.
closesodoo/odoo#112825
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
mockReadGroup should not count the value false for a many2one when
aggregating a many2one field with the aggregate function count_distinct
and should always return a number. We fix that.
Part-of: odoo/odoo#112825
Let us have records with values false, 1, 2, 1, 1 for a many2one 'm2o'.
read_group allows to get those ids in an array with the aggregate function
array_agg:
read_group([], ["m2o:array_agg", ...], []) will return
[{ __count: 5, m2o: [null, 1, 2, 1, 1], ... }]
We now support the use of array_agg for many2ones in the mock server.
Part-of: odoo/odoo#112825
Because of an issue with converting bool values, read_progress_bar didn't work
on grouping by bool fields (e.g. Active).
Related tests worked fine because mocked server responses were different from
real server responses. So, we need to adjust mocked server too.
opw-2870937
closesodoo/odoo#103926closesodoo/odoo#104613
X-original-commit: e6ca3ef1b38dec964dab416c6058d4c1b7161614
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
The mock server's mockReadGroup function would not properly compute the
range and domain of the returned groups for datetime fields with groupby
hour.
The year of the range/domain should be the same as the record and not
the current year.
Consider the following:
- a record with a datetime field of value "2016-12-14 12:34:56".
- a read_group with groupby "['datetime:hour']"
The corresponding group would have had the following metadata (considering current year is 2022):
- 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" }`
It now has the following valid metadata:
- value: `"13:00 14 Dec"`
- domain: `[["datetime", ">=", "2016-12-14 12:00:00"], ["datetime", "<", "2016-12-14 13:00:00"]]`
- range: `{ from: "2016-12-14 12:00:00", to: "2016-12-14 13:00:00" }`
X-original-commit: cca1fad650efc13cd1695acb723b9aa9a54ba184
Part-of: odoo/odoo#108947
Co-authored-by: Bruno Boi <boi@odoo.com>
Breaking on 2022->2033 transition
Those tests should be adapted to work without hardcoded dates.
closesodoo/odoo#108884
X-original-commit: 6945966b49a58ce3c0976dce37e324b37af8367a
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Unused catch block arguments are now forbidden even when prefixed with an
underscore: if the argument on the catch block is not needed, the use of the
optional catch binding is enforced.
Part-of: odoo/odoo#105433
This commit aims to make the behavior of the mocked 'read_progress_bar'
requests closer to their server implementation.
Namely, the returned dictionnary is supposed to contains the display
names of the current groups in its keys. This was not the case and has
been fixed.
Part-of: odoo/odoo#100149
PR [1] removes some `<field/>` node attributes from view archs that
were transfered into the `modifiers` attribute (e.g. `invisible`).
However, the `invisible` attribute was still used in some views
(e.g. graph, pivot, search and cohort). This issue hasn't been
spotted by the tests as the MockServer was still sending archs
with both `invisible` and `modifiers` attributes.
This commit adapts the MockServer to make it behave like the real
server, which makes some tests fail, and adapts the impacted
views to make them look into the `modifiers` attribute, which fixes
the failing tests.
Closesodoo/odoo#99920
[1] odoo/odoo#99619closesodoo/odoo#99948
Related: odoo/enterprise#31220
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
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" }`
closesodoo/odoo#96946
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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.
closesodoo/odoo#96963
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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
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.
closesodoo/odoo#93746
Related: odoo/enterprise#28449
Signed-off-by: Géry Debongnie <ged@odoo.com>
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.
closesodoo/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>
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.
closesodoo/odoo#84718
Related: odoo/enterprise#24509
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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.
closesodoo/odoo#80835
X-original-commit: 5f6d72e43eaec803eea76927433706dfd5e2be73
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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.
closesodoo/odoo#75354
Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>