[IMP] crm: Use cookies to save utm instead of session.
This commit is contained in:
parent
b6fb02a331
commit
2f1814088f
|
@ -82,7 +82,7 @@ class crm_tracking_mixin(osv.AbstractModel):
|
|||
def tracking_get_values(self, cr, uid, vals, context=None):
|
||||
for key, field in self.tracking_fields():
|
||||
column = self._all_columns[field].column
|
||||
value = vals.get(field) or (request and request.session.get(key)) # params.get should be always in session by the dispatch from ir_http
|
||||
value = vals.get(field) or (request and request.httprequest.cookies.get(key)) # params.get should be always in session by the dispatch from ir_http
|
||||
if column._type in ['many2one'] and isinstance(value, basestring): # if we receive a string for a many2one, we search / create the id
|
||||
if value:
|
||||
Model = self.pool[column._obj]
|
||||
|
|
|
@ -6,8 +6,12 @@ from openerp.osv import orm
|
|||
class ir_http(orm.AbstractModel):
|
||||
_inherit = 'ir.http'
|
||||
|
||||
def get_utm_domain_cookies(slef):
|
||||
return request.httprequest.host
|
||||
|
||||
def _dispatch(self):
|
||||
response = super(ir_http, self)._dispatch()
|
||||
for var, dummy in self.pool['crm.tracking.mixin'].tracking_fields():
|
||||
if var in request.params and (var not in request.session or request.session[var] != request.params[var]):
|
||||
request.session[var] = request.params[var]
|
||||
return super(ir_http, self)._dispatch()
|
||||
response.set_cookie(var, request.params[var], domain=self.get_utm_domain_cookies())
|
||||
return response
|
||||
|
|
Loading…
Reference in New Issue