summaryrefslogtreecommitdiff
path: root/addons/test_mail/tests/test_performance.py
AgeCommit message (Collapse)Author
2021-05-26[REV] mail: fix a traceback when sending a message in a "email channel"std-odoo
Bug === Since 4da64b3f3c8dff88d8e0e01c65374590cc0bf4f7 , if multiple users of different companies are in the same channel, and if the type of the channel is "email", a traceback is raised when sending a message. Technical ========= "with_user" drop the SU flag and is not enough to bypass the multi company ACLs. Moreover, we do not want to send a "channel_seen" bus notifications and we can mark the message as seen on the JS side directly. Changes ======= So now, the traceback is not raised anymore in that case, and the message is marked as seen if the receiver has the web client open. But, if the receiver has not the web client open, when he will login, the message will not be marked as seen. This can be improved but at the moment we just want to revert the fix that cause the traceback and fix the issue in most cases. Task 2427790 closes odoo/odoo#65185 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-06[IMP] various: update query counters according to latest runbot runThibault Delavallée
Base: seems related fields take only 1 extra query instead of 3 Crm: assignment seems to have been slightly improved. Some randomness still happens. Hr Holidays: seems it was further improved beyond space frontier Test mail: those tests were a bit random, seems random is gone (hopefully) Test mail full: updated local counters Test mass mailing: seems we gained one query, updated local counters closes odoo/odoo#70486 Related: odoo/enterprise#18180 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-04-13[FIX] {test_}mail: properly handle deletion of mail notif from composerdht-odoo
Before this commit: When someone sends mail with help of mail_composer(mail.compose.message) without having a mail template set, mail is not deleted after being sent (and causes unwanted/unexpected burden on DB). This bug was introduced with commit[1], where auto deletion was disabled if template is not set on the composer. After this commit: If there is no mail template set on the composer, or if the template is set and 'auto_delete' is enabled on that template, the mail sent from composer will be deleted after being sent successfully. A context key is added to allow controlling this behavior. It is notably use to check query counters differences. commit[1] - https://github.com/odoo/odoo/commit/8a026e26c6ae25e3fdb5369a7fa3343d70fab782#diff-898a3d5c08a567c1a7b82c026a213d796e850e376cbdb1c9e7936409f440d37aR257 Task id: 2484915 PR odoo/odoo#68870 Original Pr #68403 X-original-commit: 05ad6c477f7da2a495e5baf5b4629323b9d11fa0 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-04-13[IMP] test_mail: update performance countersThibault Delavallée
Updated compared to enterprise runbot counters of 04/13/2021 Task ID-2506047 PR odoo/odoo#68870
2021-03-10[FIX] mail: notification not sent when using the full composerPriyanka Kakadiya
Current behavior before PR: mail notification not sent when using the full composer. Desired behavior after PR is merged: mail notification will send when using the full composer. LINKS: PR https://github.com/odoo/odoo/pull/66421 Task-2446855 closes odoo/odoo#66421 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-03-08[FIX] mail, test_mail: ensure thread name is up to date on messageDidier (did)
When formatting a message, a message could be with an empty or obsolete record_name field. It's better to rely on the relation between the message and the thread and fetch the current thread name. task-2411715 closes odoo/odoo#63000 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-03-08[IMP] test_mail: add query count test record_name in message_formatDidier (did)
This will count the number of query when formating messages, in particular for the thread name query that is changed in the following commit. Part of task-2411715
2020-08-18[IMP] core: introduce subqueries in searchRaphael Collet
Make the method `_search` return a `Query` object, and make that object generate a subquery when used on the right-hand side of a condition. closes odoo/odoo#52403 Related: odoo/enterprise#10945 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-05-12[IMP] test_(mass_)mail(ing): update counters to current runbot resultsThibault Delavallée
Spotted when working on task ID 2238597
2020-04-29[FIX] base: Make OdooBot partner cross companyLucas Lefèvre
Steps to reproduce: - Create a second company - Enable this company only - Create a new company => Access error is raised because the `intercompany_user_id` is OdooBot by default and OdooBot's partner cannot be read from other companies. Hence, the company creation fails. Like all other internal users/partners, OdooBot's partner should be shared across companies, even if its user is inactive. Task 2157039 See also 2390ba6 Task 2157039 closes odoo/odoo#50372 X-original-commit: 379d14d4aa7862176fb7e3f79292a1228c254aa9 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com> Signed-off-by: lul-odoo <LucasLefevre@users.noreply.github.com>
2020-04-22[REF] test_mail: sun is shining, no more umbrellasThibault Delavallée
PURPOSE Have a cleaner test_mail addons SPECIFICATIONS Umbrella -> Container, easier to understand that we target a ticket / project like model using mail.test.ticket and mail.test.container . LINKS Prepares Task ID 2238597 (clean notification models) Prepares Task ID 2083854 (improve mass mailing technical flows) PR #49891
2020-04-22[REF] test_mail: rename test models to ease understandingThibault Delavallée
PURPOSE Have a cleaner test_mail addons SPECIFICATIONS Keep only mail-related tests, move odoobot in test mail full, send "update notification" tests in mail (specific to mail). Merge some test files to lessen number of files, perform light file renaming. Split test mail models file to prepare some cleaning in those models and tests. LINKS Prepares Task ID 2238597 (clean notification models) Prepares Task ID 2083854 (improve mass mailing technical flows) PR #49891
2020-04-22[MOV] (test_)mail(_full): redispatch some tests and split test mail models fileThibault Delavallée
PURPOSE Have a cleaner test_mail addons SPECIFICATIONS Keep only mail-related tests, move odoobot in test mail full, send "update notification" tests in mail (specific to mail). Merge some test files to lessen number of files, perform light file renaming. Split test mail models file to prepare some cleaning in those models and tests. LINKS Prepares Task ID 2238597 (clean notification models) Prepares Task ID 2083854 (improve mass mailing technical flows) PR #49891
2020-04-10[ADD] mail_bot_hr: Bridge module to remove mail_bot dependency from hrdmonzonis
In v12, the hr module did not have a hard dependency on mail_bot, so the users could uninstall it if they did not want/need its functionality. In v13, mail_bot was added as a dependency to include the notification widget and the odoobot state in the user forms modified by the hr module. However, this also brings potentially unwanted functionality to anyone who installs an hr related application. This commit removes the dependency on mail_bot by adding the mail_bot_hr bridge module, which provides integration between mail_bot and hr if both modules are installed.
2020-03-25[FIX] test_mail: adapt query countSébastien Theys
A commit merged very recently added 1 more base query to both users, but because the count of that particular test is non deterministic, the issue is only spotted later on runbot, and it has to be fixed now. closes odoo/odoo#48331 Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2020-03-11[FIX] mail: attachments in the message when marking activity as donejvm-odoo
Fine tuning of 1e411e3a6d - It moves the attachment in the message when we mark an activity as done. - It adds a test OPW-2196668 closes odoo/odoo#47349 X-original-commit: 2033066426a6af6eed5f80f1bcde6e650e998f0d Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-03-06[IMP] models, (test_)mail, portal(_rating): remove `message_tree`Sébastien Theys
from `message_format` and from `_message_read_dict_postprocess`. The reading and initial formatting is done by `_message_read_dict_postprocess`, which has been renamed more simply to `_message_format` due to its new goal. This makes the methods easier to follow and does not increase the query count. It actually reduces it when the data were already in the cache, by not always reading them again. Part of task-2180311 PR: #43841
2020-03-06[IMP] mail, test_mail: simplify subtype in `message_format`Sébastien Theys
This makes the method easier to follow and does not increase the query count. It actually reduces it when the subtype data were already in the cache, by not always reading them again. Part of task-2180311 PR: #43841
2020-03-06[IMP] mail, test_mail: simplify notification and tracking valuesSébastien Theys
in `message_format` and in `_message_read_dict_postprocess`. This makes the method easier to follow and does not increase the query count. It actually reduces it when the notifications and tracking data were already in the cache, by not always reading them again. Part of task-2180311 PR: #43841
2020-03-06[IMP] mail, test_mail: simplify attachmentSébastien Theys
in `_message_read_dict_postprocess`. This makes the method easier to follow and does not increase the query count. It actually reduces it when the attachment data were already in the cache, by not always reading them again. The `has_access_to_model` is removed and replaced by `sudo` because: - from portal everything is sudo so it's pointless to check access on top of it - from backend, it's almost impossible to trigger the case, and it's not like returning is_main True would leak any sensitive information to an employee Part of task-2180311 PR: #43841
2020-03-06[IMP] test_mail: introduce performance test for `message_format`Sébastien Theys
It was partially tested already as part of some other performance tests, but this new test will cover more specific cases of `message_format` and `_message_read_dict_postprocess`. The goal is to ensure the performances are not made worse by the following commits, or even to be able to notice when they are made better. Part of task-2180311 PR: #43841
2020-03-06[IMP] test_mail: adapt query countSébastien Theys
Part of task-2180311 PR: #43841
2020-03-06[IMP] test_mail: clean test log with appropriate mute loggerSébastien Theys
Similar to what is done for the other tests, mute unnecessary log such as `odoo.tests: skip sending email in test mode`. Part of task-2180311 PR: #43841
2020-02-25[IMP] core: optimize read() by avoiding useless querySébastien Theys
When the `select` returns nothing more than ids that are already known, there is no need to make it at all. This removes one query from `_read` every time it has to fetch only fields that are stored in a different table (o2m, ...), which happens all the time when reading a stored field first (triggering prefetch) and then reading a o2m. The query that is now removed was used to check access rules, but the trick is to use `check_access_rule` to verify the rules in python instead. Part of task-2061122 closes odoo/odoo#36263 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-02-25[IMP] test_mail, test_mass_mailing: adapt query countSébastien Theys
To see impact of following commit.
2020-02-11[REF] mail, various: remove user_signature field from mail.templatemcm-odoo
RATIONALE Mail template model holds a field telling odoo mail engine to automatically add the current user's signature to the body. Its use depends on the use case * using the template in the composer on a single record: it is displayed in the rendered template in the composer, meaning people could change it. This behavior is interesting as it allows to see the email content; * using the template in the composer in mass mail mode: it is not displayed as only the raw jinja is displayed. It is therefore not obvious that it will be appended to the body of the mail. People could add it manually and have 2 signatures as a result; A mechanism automatically adding a signature to sent emails when posting a message is already implemented and is based on template existence. If a template has been used when posting, no signature is added in sent emails. Otherwise it is automatically added. This behavior should not change. Behavior will therefore be * use a template -> specify signature usage in it manually through jinja; * do not use a template -> signature added in sent emails; SPECIFICATIONS Remove user_signature. Update template body accordingly. In customer oriented templates that are using it and do not already contain it, manually add a call to user.signature within the jinja code. When set to False, just remove its declaration. Quickly clean some signature integration. LINKS Task ID 2089252 Community PR odoo/odoo#39482 Enterprise PR odoo/enterprise#6459 Upgrade PR odoo/upgrate#761 Related: odoo/enterprise#6459 Related: odoo/upgrade#761 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com> Co-authored-by: Michaël Mattiello <mcm@odoo.com> Co-authored-by: Thibault Delavallée <tde@odoo.com>
2020-02-05[IMP] mail: add tracking on computed stored fieldsRaphael Collet
Also delay the tracking until pre-commit, so that several updates on a record generate a single tracking message.
2020-02-05[IMP] mail: email channels duplicated notificationsmgh-odoo
This commit prevents sending a notification within Odoo when a message is posted from a mailing channel to a user whose notification management preference is set to "Handle by Emails". Task-ID 2033302 closes odoo/odoo#36000 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-02-04[ADD] *: add ir.model.access on all transient modelsMartin Trigaux
Following changes needing ir.model.access on transient models too. Remove groups declaration on the action to move it to ir.model.access when possible. Rules are strict by default with no unlink access by default and high priviledge asked. Adaptations may be needed later. Write access is given as a wizard may need to be modified in case the action triggers an error and the user has to correct a value account*: use account.group_account_user for all transient by default remove account.print.journal relic stock*: use stock.group_stock_user by default survey: survey user can send invitations mail: allow any employee to execute wizards additional verifications are made to ensure they are executed only on the documents the user has access to you give portal access to mail.compose.message as portal still does some actions like posting messages on the forum add ir.rule to avoid reading somebody else messages increase the query count because of undeterminist count crm: saleman for lead2opp, manager for massmailing partner manager for actions linked to partners avoid a write in test_lead_lost sms: any employee can send sms mrp: mrp user can execute wizards give unlink access as making write during do_produce operation base_import: employees can import files delivery: stock user can deliver event_sale: sale user can configure the wizards event user inherit from sale rights gamification: employee can give badge google_service: resolve FIXME hr: add specific rights manager can set a plan according to group on button anyone who can write on an employee can register a departure hr_expense: set rights based on buttons hr_holidays: an approver can make a summary report hr_recruitment: recruiter can refuse a candidate hr_timesheet: can use the wizard if can create a timesheet l10n_eu_service: managers can create fiscal positions mass_mailing: same group as on mass.mailing.list membership: accountant can create invoice from membership payment: accountant can create a link as the source is an account.move keep the payment.acquirer.onboarding.wizard to system user only as it is called during company configuration point_of_sale: PoS manager only can use wizards never create closing_balance_confirm_wizard records product_expiry: stock user has rights on stock.picking product_margin: access from accounting menus repair: same rules as for above models sale: set ir.rule for self wizard only add rule from model introduced in payment to add salesman group sale_crm: saleman can create a quotation from a lead sale_coupon: any saleman can generate coupon add self ir.rule sale_product_configurator: salesman can select product variants snailmail: employee can send letters website: designers can write on website website_crm_partner_assign: same rule as group on action website_sale: sale ACL as for payment.acquirer.onboarding.wizard website_slides: anyone can send invitation base: base.language.*: allow employee (cf lang_install) change.password.user: can not read change password wizard of other users test.*: no access is needed Courtesy of Damien Bouvy, William Andre and Antoine Prieëls for review of acl
2020-01-23Revert "[IMP] test_mail(_full): run tests at post_install"Xavier-Do
This reverts commit 976e560a877bcaf9e769b6005d33bd49833eceb9. Even if it didn't looked like a bad idea, this need some more thinking. This new version of query count creates random failure of runbot builds. closes odoo/odoo#43820 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-01-22[IMP] test_mail(_full): run tests at post_installSébastien Theys
- take advantage of runbot multi-build capabilities - get similar result when running them locally during dev - better detect when other modules add extra queries Query counts are split in the base value (testing with just test_mail installed) + the extra modules overhead. Part of task-2178641 closes odoo/odoo#43666 Pr: #43666 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-01-14[IMP] *: update query countsVictor Feyens
Query counts weren't adapted to recent performance changes. This commit updates the different query counts to make sure any commit changing the query counts knows it and does it on purpose. Some query counts may vary between community and enterprise and therefore have a higher value than needed in community version. closes odoo/odoo#43202 Related: odoo/enterprise#7682 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-12-02[REF] mail, various: rename subtype parameter of message_post to subtype_xmlidThibault Delavallée
PURPOSE Clean posting process and improve mail.message definition and comprehension. SPECIFICATIONS In order to be more explicit subtype parameter is renamed to subtype_xmlid. It therefore clearly indicates it should be a valid subtype Xml ID. Support of ill formatted Xml IDs is removed because there is no reason to try to add some random prefix. Give something that exists or go to hell, punk ! LINKS Task ID 2071556 PR #38692
2019-11-29[FIX] mail: restrict access to mail.mail modelThibault Delavallée
From now on mail.mail is considered as a technical model. Indeed people should not really manually craft mails by hand. Instead various functional flows should either send mails, either craft mails based on some user input. We therefore make mail restricted to admin users. Flows creating mail.mail are updated to use sudo, and ensure it was done in a context that makes sense to delegate this power to the user. Task ID 1853147 PR #32243
2019-11-25[FIX] fields: do not prefetch fields translated with a callableRaphael Collet
This is a performance fix. It avoids the cost of XML/HTML translations for fields that may not be necessary when prefetching fields on records. This patch marks such fields as non-prefetchable by default. The code that changes the attribute `translate` on HTML fields (from `translate=True` to `translate=html_translate`) has been adapted to allow the setup of textual fields to mark the field as non-prefetchable. Jairo Llopis made a comparative benchmark: evaluating `name_get` on `event.event` records. The method needs the field `name` and without the patch, the prefetching mechanism reads the translated HTML field `description` as well. This patch speeds up the benchmark from 5800ms to 800ms (see https://github.com/odoo/odoo/pull/37967#issuecomment-538364011). closes odoo/odoo#40771 X-original-commit: e5ee5e5b65f85d66c8d59594ead9eece172c4282 Signed-off-by: Raphael Collet (rco) <rco@openerp.com> Co-authored-by: Pedro Baeza <pedro.baeza@tecnativa.com> Co-authored-by: Jairo Llopis <jairo.llopis@tecnativa.com>
2019-11-19[IMP] mail: track fields based on ir_model_fieldsKevin Baptiste
The tracked field is now a relation to the corresponding ir.model.field. This prevents potential privacy issues should the field be deleted or renamed. closes odoo/odoo#39232 Taskid: 2088634 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-11-05[IMP] test_mail: Adapt tests to work with/without demo dataYannick Tivisse
2019-10-21[FIX] test_mail: pump up non deterministic query countXavier-Do
New performances test looks non deterministic, sometimes break with 28 queries instead of 25. This commit temporary pump up query count to avoid staging fails, further investigation is needed. closes odoo/odoo#39132 Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2019-10-18[IMP] test_mail: add performance test for composer creation and send_mailThibault Delavallée
Currently there are some high-level tests that trigger composer creation, call or send_mail action. However it is always a good idea to have some performance tests only for some parts of mail application. In this commit we also fix some naming and remove unnecessary variables as a side dish. closes odoo/odoo#38475 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-10-09[MERGE] forward port branch 13.0 up to f4105eb9c70Christophe Simonis
2019-10-07[FIX] test_mail: query countsRaphael Collet
closes odoo/odoo#38034 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-10-08[FIX] mail: translate assignation msg in recipient langfw-bot
Before this commit, when assigning a user onto a record, through the field user_id, the email was sent in the current user's language After this commit, it is sent in the partner's language OPW 2060898 closes odoo/odoo#38142 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-09-30[FIX] test_mail: adapt query countsRaphael Collet
closes odoo/odoo#37577 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-09-30[FIX] test_mail: wrong way to check many2many valuesRaphael Collet
2019-09-12[IMP] test_mail: update query count to reflect improvementsSébastien Theys
Set threshold to actual values since these have not been updated after recent improvements. PR: #36654 Part of task-2070602
2019-09-17[REF] mail: remove deprecated email formataddrJulien Castiaux
[PEP 594] is going to depreciate the legacy `email.message.Message` API and its related modules. Among them the `email.utils.formataddr` function, this function takes a `(name, email)` pair and returns a string value suitable for From, To and Cc headers. The stdlib function is capable of handling several character encoding and two binary-to-ascii encoding. Odoo only uses `utf-8` which is compatible with the base64 b2a encoding. The re-implementation of that function has been simplified to only support base64-ed utf-8 and ascii. [PEP 594]: https://www.python.org/dev/peps/pep-0594/\#email-lagacy-api
2019-08-20[IMP] models: ORM speedupRaphael Collet
This branch is the combination of several optimizations in the ORM: * store field values once in the cache: the cache reflects more faithfully the database, only fields that explicitly depend on the context have an extra indirection in the cache; * delay recomputations by default: use method `recompute` to explicitly flush out pending recomputations; * delay updates in method `write`: updates are stored in a data structure that can be flushed efficiently to the database with method `flush` (which also flush out recomputations); * make method `modified` take advantage of inverse fields to inverse dependencies; * filter records by evaluating a domain on records in Python; * a computed field with `readonly=False` behaves like a normal field with an onchange method; * computed fields are computed in superuser mode by default. Work done by Toufik Ben Jaa, Raphael Collet, Denis Ledoux and Fabien Pinckaers. closes odoo/odoo#35659 Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
2019-08-14[MERGE] forward port branch saas-12.4 up to 98a55917a60Christophe Simonis
2019-08-08[MERGE] forward port branch saas-12.3 up to 752b2553c6fChristophe Simonis
2019-08-06[MERGE] forward port branch saas-12.2 up to 9e74730a26bChristophe Simonis