diff options
| author | Benoit Socias <bso@odoo.com> | 2020-12-08 14:20:43 +0000 |
|---|---|---|
| committer | Jeremy Kersten <jke@odoo.com> | 2020-12-11 16:09:35 +0000 |
| commit | 0f9411d10753aa96103ce77702dbdc0516e9969a (patch) | |
| tree | fc5edb26e763a94275bbd57d3d9d9747063bc361 /addons/gamification/data | |
| parent | d33d7bdf21d8a0743a1fa10b9f248d42a20f7785 (diff) | |
[IMP] gamification,gamification_sale_crm: compute goals using batch mode
Trying to improve the resources used by the challenge update cron
operation.
Before this commit some count-based goals and all sum-based goals were
computed with one select count or sum per user.
After this commit each count or sum based goal is computed in a single select
for all users. The goal form now also allows to enable batch mode for
sum computations. Other changes include:
- adding an index on the challenge_id of goals after verifying the
positive impact of such an index on high volumes on a staging server
- introducing additional intermediary commits to allow massive crons to
catch up over several attempts.
task-internal
closes odoo/odoo#63030
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Diffstat (limited to 'addons/gamification/data')
| -rw-r--r-- | addons/gamification/data/goal_base.xml | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/gamification/data/goal_base.xml b/addons/gamification/data/goal_base.xml index a347e17a186..574d3e57719 100644 --- a/addons/gamification/data/goal_base.xml +++ b/addons/gamification/data/goal_base.xml @@ -232,9 +232,12 @@ <field name="computation_mode">count</field> <field name="display_mode">boolean</field> <field name="model_id" ref="base.model_res_users"/> - <field name="domain">[('id','=',user.id),('partner_id.tz', '!=', False)]</field> + <field name="domain">[('partner_id.tz', '!=', False)]</field> <field name="action_id" ref="base.action_res_users_my"/> <field name="res_id_field">user.id</field> + <field name="batch_mode">True</field> + <field name="batch_distinctive_field" ref="base.field_res_users__id"/> + <field name="batch_user_expression">user.id</field> </record> <record model="gamification.goal.definition" id="definition_base_company_data"> @@ -254,7 +257,7 @@ <field name="computation_mode">count</field> <field name="display_mode">boolean</field> <field name="model_id" ref="base.model_res_company"/> - <field name="domain">[('user_ids', 'in', user.id),('logo', '!=', False)]</field> + <field name="domain">[('user_ids', 'in', [user.id]),('logo', '!=', False)]</field> <field name="action_id" ref="base.action_res_company_form"/> <field name="res_id_field">user.company_id.id</field> </record> |
