<feed xmlns='http://www.w3.org/2005/Atom'>
<title>Odoo/addons/web/static/src/js/core/utils.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: Model: extensions registry</title>
<updated>2020-07-23T08:21:10+00:00</updated>
<author>
<name>Julien Mougenot</name>
<email>jum@odoo.com</email>
</author>
<published>2020-07-13T13:14:32+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=d6ffbfd479fcd235e6e8fdad2cbd84286ca359b6'/>
<id>d6ffbfd479fcd235e6e8fdad2cbd84286ca359b6</id>
<content type='text'>
Refactoring of the Model class of `model.js` to support multiple
extensions.

The purpose is to build a model having the appropriate modules for a
given situation. For instance, we don't need the control panel model if
we don't have a control panel to start with.

Some logic of the control panel model (which was until now the "main"
search model) has been given to another model extension named
"Search Model Extension" which will synchronize the informations of all
models providing search data (domain, context, etc.).

The model instantiated in the actions/views is now an instance of the
"Action Model" (which directly extends the Model) and is meant to
replace the view model in the long term. It might however need some
improvements to hold such a role (partial interface rendering, etc.).

Part of task 2228968

Co-authored-by: Julien Mougenot &lt;jum@odoo.com&gt;
Co-authored-by: Mathieu Duckerts-Antoine &lt;dam@odoo.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Refactoring of the Model class of `model.js` to support multiple
extensions.

The purpose is to build a model having the appropriate modules for a
given situation. For instance, we don't need the control panel model if
we don't have a control panel to start with.

Some logic of the control panel model (which was until now the "main"
search model) has been given to another model extension named
"Search Model Extension" which will synchronize the informations of all
models providing search data (domain, context, etc.).

The model instantiated in the actions/views is now an instance of the
"Action Model" (which directly extends the Model) and is meant to
replace the view model in the long term. It might however need some
improvements to hold such a role (partial interface rendering, etc.).

Part of task 2228968

Co-authored-by: Julien Mougenot &lt;jum@odoo.com&gt;
Co-authored-by: Mathieu Duckerts-Antoine &lt;dam@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>[REF] web,mail: use patchMixin and patch instead of utils.patch</title>
<updated>2020-04-16T07:19:55+00:00</updated>
<author>
<name>Michael Mattiello (mcm)</name>
<email>mcm@odoo.com</email>
</author>
<published>2020-04-15T12:09:56+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=f0aa343fe2d5680b27895e13b9962b3c4a9b9881'/>
<id>f0aa343fe2d5680b27895e13b9962b3c4a9b9881</id>
<content type='text'>
This commit replaces the use of utils.patch by the new class patcher and
makes the renderers that are converted to owl patchable.

closes odoo/odoo#47700

Related: odoo/enterprise#9551
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>
This commit replaces the use of utils.patch by the new class patcher and
makes the renderers that are converted to owl patchable.

closes odoo/odoo#47700

Related: odoo/enterprise#9551
Signed-off-by: Géry Debongnie (ged) &lt;ged@openerp.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] web: add es6 class patcher</title>
<updated>2020-04-16T07:19:25+00:00</updated>
<author>
<name>Michael Mattiello (mcm)</name>
<email>mcm@odoo.com</email>
</author>
<published>2020-03-16T08:28:17+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=dcf9a4c38da5d50a6e597d3d68c3d46fdef61df5'/>
<id>dcf9a4c38da5d50a6e597d3d68c3d46fdef61df5</id>
<content type='text'>
This commit implements a new way to monkey-patch ES6
classes (for instance, Owl Components).

Usage
-----

odoo.module('module.BaseClass', function (require) {
    const patchMixin = require('web.patchMixin');

    // Define your class as usual
    class BaseClass {
        constructor() {
            this.foo = 'foo';
        }
        bar() {
            console.log(this.foo);
        }
    }

    // but export it like this to have a "patchable" version
    return patchMixin(BaseClass);
});

odoo.module('module.Patch', function (require) {
    // imports the "patchable" version
    const BaseClass = require('module.BaseClass');

    BaseClass.patch('key', T =&gt;
        class extends T {
            constructor() {
                super();
                this.foo = 'patched foo';
            }
            bar() {
                super.bar();
                console.log('patched bar()');
            }
        }
    );
});

odoo.module('module.instance', function (require) {
    // imports the "patchable" version
    const BaseClass = require('module.BaseClass');

    const obj = new BaseClass();
    obj.bar();
    // if module.patch is loaded before this module the patch
    // will be apply and calling obj.bar() will log:
    // patched foo
    // patched bar()

    // You can unpatch a patchable class
    BaseClass.unpatch('key');
});</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit implements a new way to monkey-patch ES6
classes (for instance, Owl Components).

Usage
-----

odoo.module('module.BaseClass', function (require) {
    const patchMixin = require('web.patchMixin');

    // Define your class as usual
    class BaseClass {
        constructor() {
            this.foo = 'foo';
        }
        bar() {
            console.log(this.foo);
        }
    }

    // but export it like this to have a "patchable" version
    return patchMixin(BaseClass);
});

odoo.module('module.Patch', function (require) {
    // imports the "patchable" version
    const BaseClass = require('module.BaseClass');

    BaseClass.patch('key', T =&gt;
        class extends T {
            constructor() {
                super();
                this.foo = 'patched foo';
            }
            bar() {
                super.bar();
                console.log('patched bar()');
            }
        }
    );
});

odoo.module('module.instance', function (require) {
    // imports the "patchable" version
    const BaseClass = require('module.BaseClass');

    const obj = new BaseClass();
    obj.bar();
    // if module.patch is loaded before this module the patch
    // will be apply and calling obj.bar() will log:
    // patched foo
    // patched bar()

    // You can unpatch a patchable class
    BaseClass.unpatch('key');
});</pre>
</div>
</content>
</entry>
<entry>
<title>[REF] web: add missing features of abstract field</title>
<updated>2020-03-31T06:13:11+00:00</updated>
<author>
<name>Michael Mattiello (mcm)</name>
<email>mcm@odoo.com</email>
</author>
<published>2020-03-27T10:49:43+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=cde276a1efe39175bb35aa6cc09f1aaa00009c6d'/>
<id>cde276a1efe39175bb35aa6cc09f1aaa00009c6d</id>
<content type='text'>
This commit adds missing features of AbstractField written in owl.

task id: 2193996</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit adds missing features of AbstractField written in owl.

task id: 2193996</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>[IMP] web,*: Enhance test helpers</title>
<updated>2020-03-13T11:39:53+00:00</updated>
<author>
<name>Julien Mougenot</name>
<email>jum@odoo.com</email>
</author>
<published>2020-03-11T09:38:27+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=0a129284e4856b6485c48a194fd86c3ab5c736e7'/>
<id>0a129284e4856b6485c48a194fd86c3ab5c736e7</id>
<content type='text'>
1. Test utils helpers adapted to properly instantiate the new Owl control panel
2. New file 'test_utils_control_panel' to create a control panel and use helpers
3. New helper: createComponent (creates a generic component, see jsdoc)
4. Use of the new helpers in the current tests (more in sibling commits)
5. Helper 'addMockEnvironment' is now asynchronous
6. Owl config mode set to 'dev' in test suite (props validation)

Part of task 2196029

Co-authored-by: Mathieu Duckerts-Antoine &lt;dam@odoo.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
1. Test utils helpers adapted to properly instantiate the new Owl control panel
2. New file 'test_utils_control_panel' to create a control panel and use helpers
3. New helper: createComponent (creates a generic component, see jsdoc)
4. Use of the new helpers in the current tests (more in sibling commits)
5. Helper 'addMockEnvironment' is now asynchronous
6. Owl config mode set to 'dev' in test suite (props validation)

Part of task 2196029

Co-authored-by: Mathieu Duckerts-Antoine &lt;dam@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>
</feed>
