Commit Graph
30 Commits
Author SHA1 Message Date
Nimesh Jethva 427ba08e0d [IMP]various: Improvement in model description
Purpose of this commit is to give description more "business oriented"
because those descriptions appears in Odoo Studio which is supposed to be used by end users, not only by developers.

Related Task ID : 37311
2018-09-21 11:45:15 +02:00
Raphael Collet 2f7c03d9ca [IMP] base: add regular user admin as uid 2
User 1 simply becomes a technical user (inactive, no password).
2018-08-23 21:38:57 +02:00
Raphael Collet 2a2ff6eb5c [FIX] tools: serialize lazy to json 2018-08-16 16:39:20 +02:00
Raphael Collet 0ab6845ed8 [FIX] models: make read_group() call name_get() on demand only
This improves the performance of code using read_group() without actually using
the display names of the result.  It also optimizes name_search().
2018-07-24 17:02:07 +02:00
Raphael Collet b1e83fd7b8 [REF] models: make create work in batch
Add a decorator `model_create_multi` to indicate whether a `create` method is
implemented to work in batch.
2018-07-24 16:58:14 +02:00
Christophe Simonis 7113b70762 [FIX] test_performance: adapt new test to new api 2018-04-23 19:13:23 +02:00
Christophe Simonis e8bf128318 [MERGE] forward port branch 11.0 up to 3ab25b60bc 2018-04-23 18:15:25 +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
Raphael Collet ba25420312 [REF] tests: decorators and method to count queries (#21499)
Add the context manager method `assertQueryCount` to count queries,
the decorator `@users(...)` to execute a test for several users, and
the decorator `@warmup` to execute a test twice (warm-up, then real).
2017-12-12 15:52:35 +01:00
Thibault Delavallée 010add2903 [FIX] test_(performance/mail): better use test_performance in test_mail and update counters
Containing

 * fix self._round not always existing;
 * fix counter for activity creation;
 * use self.str() in order to have some variation in test_mail;
 * separate base performance to mail feature specific performance tests;
2017-12-06 11:33:10 +01:00
Thibault Delavallée 22cce3be9d [ADD] test_mail: add some performances tests 2017-11-29 10:11:15 +01:00
Thibault Delavallée 1cc1ef5058 [SPLIT] test_performance: split between base and mail performance tests
Test performance will now hold the base class for performance tests as
well as tests related to the ORM, depending only on base. A new module
test_mail is introduced at this commit that contains performance tests
related to mail module. This commit contains only code move and should
not impact anything.

Future commits will move mail tests into test_mail so that all mail
related tests are located in the same optional module. This allows
notably to avoid creating a lot of unnecessary tables when installing
mail module on production databases.
2017-11-29 10:05:01 +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