summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/env/test_env.js
AgeCommit message (Collapse)Author
2020-09-16[FIX] mail: do not fetch attachment style in QUnit testsAlexandre Kühn
Task-2339931 closes odoo/odoo#57869 X-original-commit: 7586f7756859bb0711eee8a82bf728a039ad0d72 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-08-27[FIX] mail: 'Cannot read messagingMenu of undefined' tracebackAlexandre Kühn
Before this commit, on page reload, sometimes web client crashed with `Cannot read 'messagingMenu' of undefined`. This happens due to messaging components making use of `messaging` in `env` as if it was always set. In some rare cases, this is false, hence the crash. This happens on root components of messaging such as the messaging menu. Creation of `env.messaging` has to be async, in other to ensure all JS module that patches messaging are applied. The mounting of messaging root components depends on other parts of the web client like the SystrayMenu. So the proper fix is to guard `env.messaging` on these root components. Task-2238245 closes odoo/odoo#56682 X-original-commit: d1483ff3c83bb3146e80e5d65a27915c5b2a2bf9 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-08-13[IMP] web, *: improve mock server and replace most mail mockRPCSébastien Theys
Improve mock server: - add support for mocked `fetch` - add support for `active_test` - add support for x2m `in` in domains - add support for default values computed from a function - implement a more natural "next id" compute - allow initial data without ids - ensure write and x2m commands integrity - improve bad data/bad commands error messages - always warn for failing RPC, not only in debug mode - fix all existing tests that had inconsistency data Other changes done in mail (or dependents) that are not just related to tests: - remove `direct_partner` from formatter result ->`correspondent` can be computed from other keys, especially `members` - fix `livechat_visitor` convertData -> only process if there is value - add `current_partner` and `current_user_id` as `init_messaging` result -> easier to mock than session - remove usage of `need_moderation` -> that was just a search indirection to `moderation_status` - adapt `partner_id` -> `res_partner_id` key in `_notification_format` -> to be consistent with field name - add name in result of `mail_partner_format` -> sometimes display_name is not the same - remove usage of `is_moderator` -> that was just an indirection to `moderation_channel_ids` Enterprise counterpart: https://github.com/odoo/enterprise/pull/11523 task-2287171 closes odoo/odoo#55854 X-original-commit: 7ba3fecb3377a720d1eb70e7515a0c45da73836d Related: odoo/enterprise#12391 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
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-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>