summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/model/model_manager.js
AgeCommit message (Collapse)Author
2020-09-23[FIX] mail: ignore `undefined` in JS fields create/writeSébastien Theys
Passing a field containing `undefined` should lead to the same result as not passing the field. Fields that relied on `undefined` as a value have been changed to use the newly introduced `clear` command, that resets a field to its default value (often that is equal to `undefined`). task-2336491 closes odoo/odoo#58308 X-original-commit: b18824485483564d2ab80f41914a3548aa528ae0 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-08-24[FIX] mail: introduce findFromIdentifyingDataSébastien Theys
This is necessary to check the existence of a record based on identifying data without having to use `insert` (or the inefficient `find`). PR: #56243 Part of task-2323670 X-original-commit: c4bbfc5e2a8d236e5fc79a63c13575de146afbd7
2020-08-21[FIX] mail: remove JS record proxy in favor of accessorsSébastien Theys
- accessors are defined only once on the model - they work per field which avoids having to check if target param is in fields at every read/write on record Also store fields as list in `__fieldList` to quickly iterate them without `Object.values`. `__combinedFields` are now renamed to `__fieldMap` instead of just `fields` to avoid confusion with fields definition, and to have a naming similar to `__fieldList`. Part of task-2308312 closes odoo/odoo#56314 X-original-commit: 42a94d49b9e8333cf91807c96f0ddd740782915e Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-08-21[FIX] mail: avoid unnecessary update of inverse in JS modelsSébastien Theys
Part of task-2308312 X-original-commit: 0e08e43decf18108d25d051ad76c093bcdf434db
2020-08-05[FIX] mail: clean up JS relations by storing recordsSébastien Theys
Remove the support and the conversion from record to localId and back from localId to record. Part of task-2308312 closes odoo/odoo#55481 X-original-commit: fc5e8be4e65518770a281f0dffae07854d20073a Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-08-03[FIX] mail: save JS records per model and use exists if possibleSébastien Theys
This allows get to be simplified to only handle local id. Part of task-2308312 closes odoo/odoo#55346 X-original-commit: fa013d1d29e64706a08499d0f564327766410f8e Related: odoo/enterprise#12159 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-08-03[FIX] mail: speed up JS models by better using JS languageSébastien Theys
- use Map for _toComputeFields - factorize const access out of loops - avoid Object.entries - introduces `exists` method to avoid costly call to `get` - ensure compute are using update to trigger potential _updateAfter Part of task-2308312 X-original-commit: e364886c2450872a7e42cef549f253b10e55158d
2020-08-03[FIX] mail: use Map to speed up _toUpdateAftersSébastien Theys
Part of task-2308312 X-original-commit: 225c17ea2c761cf8cd15305796e7da7c5b79353c
2020-08-03[FIX] mail: speed up insert by using localId instead of findSébastien Theys
Part of task-2308312 X-original-commit: 407dc9796543a27b6695c8d4da922c13dece5b38
2020-07-31[FIX] mail: batch create/insert of JS model for performanceSébastien Theys
PR: #55261 Part of task-2308312 closes odoo/odoo#55266 X-original-commit: eded5f6372d4f1cffd1a361bd8fa7fd8f1f8ae9e Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-07-31[FIX] mail: fix performance of JS models update cycleSébastien Theys
- wrap all JS model operations in update cycle - properly delay execution of compute during `_updateAfter` This allows to delay the execution of computes as long as possible, which significantly improves performance, especially during init_messaging with plenty of chat windows (due to compute of "visual"). PR: #55261 Part of task-2308312 X-original-commit: 79f85523ebef6b7ac4c198eec8b1e55e243f49d1
2020-07-31[FIX] mail: improve performance of JS write, especially for x2mSébastien Theys
- store `x2many` values as `Set`. This is conceptually more correct because duplicates were already not allowed, and using a `Set` allows for much faster operations such as checking the presence of a record in the relation, which is done at every write, for every linked record. - `stringify` in `write` was slow and unnecessary because we can always assume that new non-primitive should be provided to `write` - remove field values from store, in favor of just storing a counter, which is enough to trigger renders. This allows to get rid of one Proxy level around data, which was slower, but which also prevented from using `Set`. - write in store exactly once per update cycle, to trigger one `useStore` call on each component. Records keep `__state` but as a local counter, to let `useStore` know which records have been updated (easier to compare a counter than comparing each and every field value). Results ======= The worse case test (using a lot of x2m) that was used to benchmark this PR `form_renderer_tests.js` of `mail_enterprise` went from taking around 4s before this commit, to around 2.5s after this commit. And the worse `_setRelationLinkMany2Many` previously took around 250ms, and it now takes around 50ms. The whole `mail` QUnit suite took around 55s before, now around 42s. Part of task-2308312 closes odoo/odoo#55248 X-original-commit: 4db0a10d85534ef896f6bcbf13bca4983a6e2003 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-06-15[REF] mail, *: refactor messaging with OWLSébastien Theys
This commit is a significant rewriting of client-side discuss, chatter, chat window, and messaging menu using OWL. The behavior should be broadly the same, with some slight functional changes here and there. From a technical standpoint, the code of messaging is mainly organized in 2 main groups of modules: - models, which are logical entities that depict the client-side state of messaging as a whole. - components, which are in charge of displaying information from models. This refactoring also introduces new JS guidelines regarding folder structure (/static) and naming rules for JS modules. Community PR: https://github.com/odoo/odoo/pull/39023 Enterprise PR: https://github.com/odoo/enterprise/pull/6249 Task-1914207 This PR is a collaborative work by Alexandre, Julien, Sébastien and Xavier, with the precious help of Lucas to speed it up towards the end. closes odoo/odoo#39023 Related: odoo/enterprise#6249 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com> Co-authored-by: Alexandre Kühn <aku@odoo.com> Co-authored-by: Julien Giannone <jgi@odoo.com> Co-authored-by: Lucas Perais <lpe@odoo.com> Co-authored-by: Sébastien Theys <seb@odoo.com> Co-authored-by: Xavier Dubuc <xdu@odoo.com>