Skip to content
Snippets Groups Projects
Commit 5c853870 authored by Nicolas Lempereur's avatar Nicolas Lempereur
Browse files

[IMP] website_crm: set utm medium override Website

To set utm values (medium, source and campaign) on created record, the
system use default function which check cookies and other funny things.

But for website form creating a record, the medium value would be
overrided always to Website whilst that should be a fallback (and the
set medium should have priority).

closes #10848
opw-668853
parent 980cc636
Branches
Tags
No related merge requests found
......@@ -4,5 +4,9 @@ class Lead(models.Model):
_inherit = 'crm.lead'
def website_form_input_filter(self, request, values):
values.setdefault('medium_id', request.registry['ir.model.data'].xmlid_to_res_id(request.cr, SUPERUSER_ID, 'utm.utm_medium_website'))
values['medium_id'] = (
values.get('medium_id') or
self.default_get(['medium_id']).get('medium_id') or
self.sudo().env['ir.model.data'].xmlid_to_res_id('utm.utm_medium_website')
)
return values
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment