Commit Graph
20 Commits
Author SHA1 Message Date
Xavier Dollé 19fb650863 [FIX] mail: correctly filter needaction on unread notifications in message_format
Previously to this commit needaction used by JS was not taking into account
read notifications. It means notably Inbox counter could be higher than
expected as taking into account read messages while Inbox displays only
unread messages. This commit fixes that by checking notification state when
giving needaction_partner_ids to message_format result.

This fix has a small impact on performances as message_format is used in
notification process for chat or push. A better implementation of message
format and its postprocess could probably lessen this fix impact. As we
target stable version we avoid rewriting other part of the code. Optimization
will be done in development version.

Related to task ID 1841243. This is a manual backport of commit 69714fbeee
done in saas-11.2.
2018-05-16 16:00:43 +02:00
Nicolas Lempereur 96ce375c61 [FIX] models: more than one prefetch in onchange
When a record fields are prefetched, the currently accessed record is
prefetched as well as PREFETCH_MAX (=1000) minus currenly accessed
records.

Since 439fa826 the id field was thought as "prefetched" but was not,
which caused that in an onchange, we would have a prefetching as follow
for 1200 records:

- get records 1-1000
- get record 1001 (1001-1200 INTERSECTION 1-999 (id) + 1001 (current))
- get record 1002 (1002-1200 INTERSECTION 1-999 (id) + 1002 (current))
- get record 1003 (1003-1200 INTERSECTION 1-999 (id) + 1003 (current))
- ...
- get record 1200 (1200 INTERSECTION 1-999 (id) + 1200 (current))

So we would do 201 queries instead of 2 when prefetching the records.

The added test without this change failed the query count with:

 "AssertionError: 284 not less than or equal to 5 : admin"

opw-1837548
opw-1837552
closes #24326
2018-04-20 10:54:29 +02:00
Christophe Simonis 3fe94628f6 [FIX] test_performance: bump query count for tracking fields (bis) 2018-01-02 18:31:02 +01:00
Christophe Simonis 82c3d92971 [FIX] test_performance: bump query count for tracking fields 2018-01-02 18:11:25 +01:00
Christophe Simonis 26257ad7a1 [FIX] test_performance: bump query count
When `rating` is installed, a few more queries are executed...
2017-11-09 20:35:54 +01:00
Christophe Simonis e74ef6cfb9 [FIX] test_performance: bump query count
Recent changes in tracking fields add a new query. Adapt tests.
2017-11-09 19:44:38 +01:00
Raphael Collet a16c44210a [FIX] models: skip an SQL query when its result is known to be empty
In method `search`, simply make an abstract interpretation of the domain to
determine whether it is equivalent to false.  In that case, skip the query.
2017-09-29 16:14:57 +02:00
Raphael Collet 36141931bf [FIX] mail: remove field res_model_id for performance reasons (#19744) 2017-09-27 16:58:19 +02:00
Raphael Collet b4824d78eb [FIX] mail: avoid re-reading a value given to create
After a message is created with a given `author_id`, reuse `author_id` instead
of `message.author_id.id`.
2017-09-26 09:32:54 +02:00
Raphael Collet 3ca6392a3f [FIX] mail: simplify ormcache parameters to avoid queries
Make the cache depend on `user` instead of `user.groups_id`.
This saves 2 queries on each write/create of `mail.thread`.
2017-09-26 09:32:54 +02:00
Raphael Collet c6b184bb23 [FIX] fields: optimize many2many command (6, 0, ids) on new records
The command does not need to remove existing relations, as there is no relation
yet on new records.  This saves one query per many2many field with that command
in a `create`.
2017-09-21 16:10:13 +02:00
Raphael Collet 59a8234fbc [FIX] mail performance: avoid useless queries
Avoid making queries that are known to return empty recordsets, and do not
format messages to be notified on no channel.
2017-09-21 16:10:13 +02:00
Raphael Collet 69161ed69c [FIX] mail: performance, replace filter() by condition in domain 2017-09-20 13:30:56 +02:00
Raphael Collet 49f6a1b544 [FIX] fields: improve performance of many2many fields
An update by a list of commands is now guaranteed to have at most three SQL
queries to update the relation, whatever the number of commands and records.
2017-09-20 13:30:56 +02:00
Raphael Collet 87970ea344 [FIX] mail: add cached method to retrieve message subtypes
This saves queries to retrieve message subtypes for a given model.
2017-09-20 13:30:56 +02:00
Raphael Collet 38193456d4 [FIX] test_performance: log when number of queries is less than expected 2017-09-20 13:30:56 +02:00
Raphael Collet ed9e3ed699 [IMP] test_performance: run tests as demo user as well 2017-09-12 17:16:24 +02:00
Raphael Collet ee14025c52 [REF] test_performance: improve cache warmup in test methods 2017-09-12 17:16:24 +02:00
Raphael Collet d7190a3fd0 [IMP] api: reindex the record cache to improve cache hit
The record cache is indexed by `(field, record_id, key)`, where `key` depends
on the environment.  The key is either `(cr, uid, context)` or `(cr, uid)`,
depending on whether the field's value is context-dependent.  As most fields
are not context-dependent, this should avoid some cache prefetching when
swiching context.
2017-09-08 13:21:00 +02:00
Raphael Collet 81192d66d9 [ADD] test_performance: check the performance of CRUD operations 2017-09-06 16:05:10 +02:00