From d7ef283f53c29750ed182242285ce091c912c9b0 Mon Sep 17 00:00:00 2001 From: jas Date: Fri, 25 Jul 2014 11:48:15 +0530 Subject: [PATCH] [FIX] survey: trace the partner_id taking the survey; if no token, set as the current user's partner. --- addons/survey/controllers/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/survey/controllers/main.py b/addons/survey/controllers/main.py index 901a7f3629a..fafef3b95f7 100644 --- a/addons/survey/controllers/main.py +++ b/addons/survey/controllers/main.py @@ -99,7 +99,10 @@ class WebsiteSurvey(http.Controller): # Manual surveying if not token: - user_input_id = user_input_obj.create(cr, uid, {'survey_id': survey.id}, context=context) + vals = {'survey_id': survey.id} + if request.website.user_id.id != uid: + vals['partner_id'] = request.registry['res.users'].browse(cr, uid, uid, context=context).partner_id.id + user_input_id = user_input_obj.create(cr, uid, vals, context=context) user_input = user_input_obj.browse(cr, uid, [user_input_id], context=context)[0] else: try: