[FIX] crm: prevent having portal user as salesman

1. set a Sales team and add an alias
2. create a contact (customer) with an email and grant them portal
access (under the action)
3. Odoo creates a portal user
4. use the email of the contact to send an email to the alias set under
the sales team

An opportunity is created but the sales person assign to that
opportunity is the customer.

This will revert user if the user has no access to crm.lead

opw-2288442

closes odoo/odoo#54217

X-original-commit: a3fdff3dd9cc38b432b93a7cd4387cb7c38b8d06
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2020-07-08 11:06:42 +00:00
parent a5874da269
commit 0645b7efa9
+5
View File
@@ -1306,6 +1306,11 @@ class Lead(models.Model):
through message_process.
This override updates the document according to the email.
"""
# remove external users
if self.env.user.has_group('base.group_portal'):
self = self.with_context(default_user_id=False)
# remove default author when going through the mail gateway. Indeed we
# do not want to explicitly set user_id to False; however we do not
# want the gateway user to be responsible if no other responsible is