[FIX] utm: ignore utm for saleman.
When a saleman create a lead or a sale after clicking on a link to test their own campaign, they don't want to be linked to this campaign
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
from odoo import api, fields, models, SUPERUSER_ID
|
||||
from odoo.http import request
|
||||
|
||||
|
||||
@@ -60,6 +60,10 @@ class UtmMixin(models.AbstractModel):
|
||||
def default_get(self, fields):
|
||||
values = super(UtmMixin, self).default_get(fields)
|
||||
|
||||
# We ignore UTM for salemen, except some requests that could be done as superuser_id to bypass access rights.
|
||||
if self.env.uid != SUPERUSER_ID and self.env.user.has_group('base.group_sale_salesman'):
|
||||
return values
|
||||
|
||||
for url_param, field_name, cookie_name in self.env['utm.mixin'].tracking_fields():
|
||||
if field_name in fields:
|
||||
field = self._fields[field_name]
|
||||
|
||||
Reference in New Issue
Block a user