Xavier-Do ee4157a396 [FIX] crm: consistent community and enterprise query count
It looks like in enterprise, the value of has_group is already in cache
This will lead to an additional query when checking mail.message
creation access rights in community.

This commit warmup the user _has_group ormcache to avoid an
inconsistency between community and enterprise

Stack of the additional query:

```
    sql('SELECT 1 FROM res_groups_users_rel WHERE uid=%s AND gid IN\n ... (SELECT res_id FROM ir_model_data WHERE module=%s AND name=%s)') (SELECT 1 FROM res_groups_users_rel WHERE uid=29 AND gid IN (SELECT res_id FROM ir_model_data WHERE module='base' AND name='group_user'))
    execute (odoo/addons/base/models/res_users.py (self._cr.execute("""SELECT 1 FROM res_groups_users_rel WHERE uid=%s AND gid IN):847)
    _has_group (odoo/tools/cache.py (value = d[key] = self.method(*args, **kwargs)):90)
    lookup (called at <decorator-gen-111> ():2)
    _has_group (odoo/addons/base/models/res_users.py (return self.with_user(uid)._has_group(group_ext_id)):832)
    has_group (addons/mail/models/mail_message.py (if not self.env['res.users'].has_group('base.group_user'):):380)
    check_access_rule (odoo/models.py (records.check_access_rule('create')):4321)
    _create (odoo/models.py (records = self._create(data_list)):4087)
    create (odoo/api.py (return create(self, arg)):410)
    _model_create_multi (called at <decorator-gen-16> ():2)
    create (odoo/addons/base/models/ir_fields.py (recs = super().create(vals_list)):613)
    create (odoo/api.py (return create(self, arg)):410)
    _model_create_multi (called at <decorator-gen-68> ():2)
    create (addons/mail/models/mail_message.py (messages = super(Message, self).create(values_list)):599)
    create (odoo/api.py (return create(self, arg)):410)
    _model_create_multi (called at <decorator-gen-193> ():2)
    create (addons/mail/models/mail_thread.py (return self.env['mail.message'].create(create_values_list)):2132)
    _message_create (addons/mail/models/mail_thread.py (new_message = self._message_create(msg_values)):1874)
    message_post (addons/rating/models/mail_thread.py (message = super(MailThread, self).message_post(**kwargs)):14)
    message_post (addons/mail/wizard/mail_compose_message.py (ActiveModel.browse(res_id).message_post(**post_params)):321)
    _action_send_mail (addons/mail/models/mail_thread.py (return composer._action_send_mail(auto_commit=auto_commit)):1964)
    message_post_with_template (addons/mail/models/mail_thread.py (return record.message_post_with_template(False, **kwargs)):1929)
    _message_compose_with_view (addons/mail/models/mail_thread.py (self._message_compose_with_view(views_or_xmlid, **kwargs)):1933)
    message_post_with_view (addons/crm/models/crm_lead.py (opportunities_head.message_post_with_view():1336)
    _merge_opportunity (addons/crm/models/crm_team.py (merged = lead_duplicates._merge_opportunity(user_id=False, team_id=False, auto_unlink=False, max_length=0)):578)
    _allocate_leads_deduplicate (addons/crm/models/crm_team.py (assign_res = team._allocate_leads_deduplicate(candidate_lead, duplicates_cache=duplicates_lead_cache)):507)
    _allocate_leads (addons/crm/models/crm_team.py (teams_data = self._allocate_leads(work_days=work_days)):304)
    _action_assign_leads
    test_assign_perf_duplicates (odoo/tools/misc.py (return func(*args, **kwargs)):792)
```

task-2796579

Part-of: odoo/odoo#85525
2022-04-04 16:48:17 +02:00
2022-03-29 20:21:41 +02:00
…
…
…
2021-10-07 17:59:53 +00:00
2022-01-14 15:44:52 +00:00

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%