<feed xmlns='http://www.w3.org/2005/Atom'>
<title>Odoo/addons/web/static/tests/core/util_tests.js, branch 14.0</title>
<subtitle>The current checkout of upstream Odoo</subtitle>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/'/>
<entry>
<title>[IMP] web: add findWhere utils</title>
<updated>2021-05-28T13:29:21+00:00</updated>
<author>
<name>Bruno Boi</name>
<email>boi@odoo.com</email>
</author>
<published>2021-05-17T11:10:10+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=9cdde27e25b13714e24082a50673454693c954ef'/>
<id>9cdde27e25b13714e24082a50673454693c954ef</id>
<content type='text'>
closes odoo/odoo#70936

Taskid: 2412172
Related: odoo/enterprise#18366
Signed-off-by: Aaron Bohy (aab) &lt;aab@odoo.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
closes odoo/odoo#70936

Taskid: 2412172
Related: odoo/enterprise#18366
Signed-off-by: Aaron Bohy (aab) &lt;aab@odoo.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] web: utils: add groupBy function</title>
<updated>2020-06-22T13:04:00+00:00</updated>
<author>
<name>Julien Mougenot</name>
<email>jum@odoo.com</email>
</author>
<published>2020-06-19T07:06:28+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=a6cd6d5a892f5a0501c0e81fe583bd64befff5d0'/>
<id>a6cd6d5a892f5a0501c0e81fe583bd64befff5d0</id>
<content type='text'>
This commit introduces a new utility function: 'groupBy'. It is
similar in API and result as the underscore method of the same
name.

X-original-commit: 834a1967161dc537cb2d5543314a062dbac08f9c</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit introduces a new utility function: 'groupBy'. It is
similar in API and result as the underscore method of the same
name.

X-original-commit: 834a1967161dc537cb2d5543314a062dbac08f9c</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] web: add sortBy to core.utils</title>
<updated>2020-05-05T19:23:20+00:00</updated>
<author>
<name>Julien Mougenot</name>
<email>jum@odoo.com</email>
</author>
<published>2020-04-29T09:52:18+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=26491fcb4ce1e21584be0454a4178f8249ec75a9'/>
<id>26491fcb4ce1e21584be0454a4178f8249ec75a9</id>
<content type='text'>
Add a "sortBy" helper to core utils. This function takes an array and
an optional criterion as arguments and returns a new array sorted
according to the given criterion.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a "sortBy" helper to core utils. This function takes an array and
an optional criterion as arguments and returns a new array sorted
according to the given criterion.</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] web: rounding error</title>
<updated>2020-03-16T12:01:57+00:00</updated>
<author>
<name>Nicolas Martinelli</name>
<email>nim@odoo.com</email>
</author>
<published>2020-03-11T07:44:40+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=a12479aaa8cb2c8311c8d6c0fceb0dc641b44eac'/>
<id>a12479aaa8cb2c8311c8d6c0fceb0dc641b44eac</id>
<content type='text'>
In JavaScript, the following computation introduces numerical errors:
```
Math.pow(10, -4) = 0.00009999999999999999
Math.pow(10, -5) = 0.000009999999999999999
```

In the context of `round_decimals`, such errors propagate to
`round_precision`, ultimately leading to inconsistencies between Python
and JS (see #47300 for detailed use case).

Instead of computing `Math.pow(10, decimals)`, we parse the scientific
notation to prevent such inaccuracies.

We also introduce tests in line with the Python tests.

opw-2205092

closes odoo/odoo#47694

X-original-commit: cb471897bfa08d1fee6a9f49e90d9c120e1733fc
Signed-off-by: Nicolas Martinelli (nim) &lt;nim@odoo.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In JavaScript, the following computation introduces numerical errors:
```
Math.pow(10, -4) = 0.00009999999999999999
Math.pow(10, -5) = 0.000009999999999999999
```

In the context of `round_decimals`, such errors propagate to
`round_precision`, ultimately leading to inconsistencies between Python
and JS (see #47300 for detailed use case).

Instead of computing `Math.pow(10, decimals)`, we parse the scientific
notation to prevent such inaccuracies.

We also introduce tests in line with the Python tests.

opw-2205092

closes odoo/odoo#47694

X-original-commit: cb471897bfa08d1fee6a9f49e90d9c120e1733fc
Signed-off-by: Nicolas Martinelli (nim) &lt;nim@odoo.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[REV] web: allow patching getters</title>
<updated>2020-03-13T08:41:15+00:00</updated>
<author>
<name>Joseph Caburnay</name>
<email>jcb@odoo.com</email>
</author>
<published>2020-03-13T08:08:32+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=78beadb748a0bc7f533c8899dd872eaa75b893c5'/>
<id>78beadb748a0bc7f533c8899dd872eaa75b893c5</id>
<content type='text'>
This reverts commit d6b854306cae245343a7acb9edc4178d245a49fe.

The reverted commit introduced issues in patching class methods.
Introducing getters in the patch function is not actually compatible
with the original method patching.

Test for patch method is also introduced to guard patch from future
invalid modification that happened.

A more robust  way of patching classes is now being developed.

closes odoo/odoo#47557

Signed-off-by: Aaron Bohy (aab) &lt;aab@odoo.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit d6b854306cae245343a7acb9edc4178d245a49fe.

The reverted commit introduced issues in patching class methods.
Introducing getters in the patch function is not actually compatible
with the original method patching.

Test for patch method is also introduced to guard patch from future
invalid modification that happened.

A more robust  way of patching classes is now being developed.

closes odoo/odoo#47557

Signed-off-by: Aaron Bohy (aab) &lt;aab@odoo.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] web: allow patching getters</title>
<updated>2020-03-06T09:04:20+00:00</updated>
<author>
<name>Joseph Caburnay</name>
<email>jcb@odoo.com</email>
</author>
<published>2020-03-06T08:11:36+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=d6b854306cae245343a7acb9edc4178d245a49fe'/>
<id>d6b854306cae245343a7acb9edc4178d245a49fe</id>
<content type='text'>
Previous implementation of patch (web.utils) only allows patching
methods. This commit allows patching getters as well.

closes odoo/odoo#47047

Signed-off-by: Géry Debongnie (ged) &lt;ged@openerp.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previous implementation of patch (web.utils) only allows patching
methods. This commit allows patching getters as well.

closes odoo/odoo#47047

Signed-off-by: Géry Debongnie (ged) &lt;ged@openerp.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] web: human readability of negative numbers.</title>
<updated>2020-01-06T15:46:28+00:00</updated>
<author>
<name>Arnaud Joset</name>
<email>arj@odoo.com</email>
</author>
<published>2020-01-06T10:19:32+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=c411bdfe4dff6174cbe58ae3c29204ba8c9b1ea4'/>
<id>c411bdfe4dff6174cbe58ae3c29204ba8c9b1ea4</id>
<content type='text'>
Before this commit, negative numbers are never rendered as human readable (e.g. 34000 -&gt; 34k).

closes odoo/odoo#42789

Taskid: 2160790
X-original-commit: b51877c4c4c9d8cd873dd0205954fd807d62ee01
Signed-off-by: Aaron Bohy (aab) &lt;aab@odoo.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Before this commit, negative numbers are never rendered as human readable (e.g. 34000 -&gt; 34k).

closes odoo/odoo#42789

Taskid: 2160790
X-original-commit: b51877c4c4c9d8cd873dd0205954fd807d62ee01
Signed-off-by: Aaron Bohy (aab) &lt;aab@odoo.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[MERGE] forward port branch saas-12.1 up to 0f4abc5c228</title>
<updated>2019-02-22T15:25:02+00:00</updated>
<author>
<name>Christophe Simonis</name>
<email>chs@odoo.com</email>
</author>
<published>2019-02-22T15:25:02+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=0e7675847f05a63cf013210dabac82c94845217f'/>
<id>0e7675847f05a63cf013210dabac82c94845217f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] web: remove human_number limitations</title>
<updated>2019-02-15T10:51:01+00:00</updated>
<author>
<name>Mathieu Duckerts-Antoine</name>
<email>dam@odoo.com</email>
</author>
<published>2019-02-14T16:04:18+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=24b0f092b4f5ac7043430f106486fa2ab8829c21'/>
<id>24b0f092b4f5ac7043430f106486fa2ab8829c21</id>
<content type='text'>
The formatting of very big numbers (like
1.0045e+22) was not handled adequately by
the function 'human_number' in web.utils.
For those numbers, it seems more appropriate
to use the scientific format. The only
difference introduced here is the following.
Beyond a magnitude of e+21, we represent the
numbers by themselves but we keep the
number of decimals provided as parameter
(or zero by default) and we remove useless
zero decimals like in the other cases.
For instance, 1.0045e+22 is replaced by 1e+22
instead of 1.00e+22 if ask 2 decimals of
precision (and by 1.005e+22 for 3 decimals).

We have also fixed a small bug occuring in the
previous version of the function: the symbol
'E' was never used. So by the past the above
number would have be represented as
10045000P and, even worse, 1.01e+45 by
1.012e+28P.

closes odoo/odoo#31140</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The formatting of very big numbers (like
1.0045e+22) was not handled adequately by
the function 'human_number' in web.utils.
For those numbers, it seems more appropriate
to use the scientific format. The only
difference introduced here is the following.
Beyond a magnitude of e+21, we represent the
numbers by themselves but we keep the
number of decimals provided as parameter
(or zero by default) and we remove useless
zero decimals like in the other cases.
For instance, 1.0045e+22 is replaced by 1e+22
instead of 1.00e+22 if ask 2 decimals of
precision (and by 1.005e+22 for 3 decimals).

We have also fixed a small bug occuring in the
previous version of the function: the symbol
'E' was never used. So by the past the above
number would have be represented as
10045000P and, even worse, 1.01e+45 by
1.012e+28P.

closes odoo/odoo#31140</pre>
</div>
</content>
</entry>
<entry>
<title>[Generic] unaccent search</title>
<updated>2019-01-10T12:31:53+00:00</updated>
<author>
<name>mgh-odoo</name>
<email>mgh@odoo.com</email>
</author>
<published>2018-10-29T08:42:59+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=9ee9724a10fc5e835d8d42da0e9e83fe687848d8'/>
<id>9ee9724a10fc5e835d8d42da0e9e83fe687848d8</id>
<content type='text'>
- added unaccent search on POS customer/partner and product
- moved unaccent from "mail.utils" to "web.utils"
- added more character to make function accurate

We might use str.normalize(from ES6) but the problem is str.normalize method can not consider some double characters i.e. accented character when normalized it returns 2 normal characters and normalize method returns single character, so here custom unaccent method is used to normalize the string

What we can improve here: We can use str.normalize method and check if string is still have unaccented charaters that we can call our unaccent method but this unaccent method is also working and performing well

closes odoo/odoo#27671</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- added unaccent search on POS customer/partner and product
- moved unaccent from "mail.utils" to "web.utils"
- added more character to make function accurate

We might use str.normalize(from ES6) but the problem is str.normalize method can not consider some double characters i.e. accented character when normalized it returns 2 normal characters and normalize method returns single character, so here custom unaccent method is used to normalize the string

What we can improve here: We can use str.normalize method and check if string is still have unaccented charaters that we can call our unaccent method but this unaccent method is also working and performing well

closes odoo/odoo#27671</pre>
</div>
</content>
</entry>
</feed>
