Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] crm_website: fix the type of a lead created with the contact form
Lead/Opportunity type ===================== In the settings, if ``group_use_leads`` is checked, we add the group ``use_leads`` to all users in the group ``base.group_user`` To know if the setting is checked, in the model ``crm.lead``, we compute this code, ``` self.env['res.users'].has_group('crm.group_use_lead') ``` In 12.0 ======= When we compute ``sudo``, we are as the admin user. The admin user is in the group ``base.group_user`` and so, he can be in the group ``use_leads``, so everything work fine. In 13.0 ======= When we perform a ``sudo``, we keep the same user. But the visitor is not in the group ``base.group_user`` (he is in the group ``base.group_public``) So, the visitor can never be in the group ``use_leads`` Fix === To fix it, we just need to compute the method ``has_group`` as the super user (which is in the group ``base.group_user``). ``` self.with_user(SUPERUSER_ID).env['res.users'].has_group('crm.group_use_lead') ``` Task #2124421 closes odoo#40310 Signed-off-by: Thibault Delavallee (tde) <[email protected]>
- Loading branch information