Skip to content

Commit

Permalink
[IMP] website_crm: set utm medium override Website
Browse files Browse the repository at this point in the history
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 odoo#10848
opw-668853
  • Loading branch information
nle-odoo committed Feb 9, 2016
1 parent 980cc63 commit 5c85387
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion addons/website_crm/models/crm_lead.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 comments on commit 5c85387

Please sign in to comment.