[REF] survey: remove unused or unnecessary fields to clean models

PURPOSE

As new features are about to land in survey, notably live interactions [1]
and new survey building [2] performing a pre cleaning is necessary. In this
PR we clean survey models by: removing unnecessary fields, cleaning some code
and finally renaming models.

SPECIFICATIONS: QUESTION FIELD ON SURVEY.SURVEY

On survey.survey, remove question field, unnecessary related on title.

Question model holds two fields for its title: ``title`` and ``question``.
Question is simply a related on title, making the two fields completely
redundant. It is mainly due to historical reasons, when updating models for
certifications and eLearning. In this commit we keep only title field and
remove the question related field as it adds unnecessary complexity to the
model.

SPECIFICATIONS: INPUT_TYPE FIELD ON SURVEY.USER_INPUT

On survey.user_input, remove input_type and its garbage collect.

``input_type`` field exists on user input model to tell whether answer has
been created through invite or through manual click on a survey page. It
has been added a long time ago when surveys were either open to everyone,
either closed and on invite only.

Since eLearning and certification surveys access mode on surveys has evolved.
Notably being able to distinguish invite from manual survey user input is not
necessary anymore. Indeed what is important is the way people can reach the
survey, not how they created their user input.

Invitation creates token and this can be used if people effectively want to
find invitation-related user inputs.

Since 09ea5c7d49 manual entries still in draft are garbage collected.
Reason is still unclear as it is not obvious that tons of unnecessary entries
will be created. As this seems like unnecessary optimization this commit
removes that feature along with the input_type field.

SPECIFICATIONS: REPLACE URLS FIELDS BY METHODS ON SURVEY.{SURVEY, USER_INPUT}

On survey.{survey, user_input}, remove url fields replaced by methods

In this commit we remove some remaining of URL fields that are better found
using methods. Both survey and user input holds a "start" url field that is
replaced by a method call ``get_start_url`` on both survey (generic) and
user input (token specific) models. We also introduced a ``get_print_url``
method doing the same for the printable version of survey / user input.

SPECIFICATIONS: REMOVE CATEGORY FIELD ON SURVEY.SURVEY

On survey.survey, remove unused category field.

Survey model holds a ``category`` field whose purpose is to be able to somehow
categorize surveys according to their use. However using this field is not
easy as it is hidden and is a simple selection field. Module should add their
own key. Its sole use is in ``hr_recruitment_survey`` which is a niche module.
Let us clean models and lessen model complexity.

LINKS

[0] Related to Task ID 2061901 (survey models cleaning and preparation)
[1] Task ID 1972640 (live interactions)
[2] Task ID 2119587 (new frontend for building surveys)

PR #40765
This commit is contained in:
Thibault Delavallée
2019-12-05 15:21:28 +00:00
parent ca52dbaede
commit 84bb9c748d
27 changed files with 57 additions and 131 deletions
@@ -14,7 +14,6 @@
'security/hr_recruitment_survey_security.xml',
'views/hr_job_views.xml',
'views/hr_applicant_views.xml',
'views/survey_survey_views.xml',
'views/res_config_setting_views.xml',
],
'demo': [
@@ -4,7 +4,6 @@
<field name="title">Recruitment Form</field>
<field name="state">open</field>
<field name="access_mode">token</field>
<field name="category">hr_recruitment</field>
<field name="users_can_go_back" eval="True"/>
<field name="description" type="html">
<p>
@@ -3,4 +3,3 @@
from . import hr_job
from . import hr_applicant
from . import survey_survey
@@ -18,13 +18,9 @@ class Applicant(models.Model):
else:
response = self.response_id
# grab the token of the response and start surveying
return self.survey_id.with_context(survey_token=response.token).action_start_survey()
return self.survey_id.action_start_survey(answer=response)
def action_print_survey(self):
""" If response is available then print this response otherwise print survey form (print template of the survey) """
self.ensure_one()
if not self.response_id:
return self.survey_id.action_print_survey()
else:
response = self.response_id
return self.survey_id.with_context(survey_token=response.token).action_print_survey()
return self.survey_id.action_print_survey(answer=self.response_id)
@@ -1,6 +1,6 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
from odoo import fields, models
class Job(models.Model):
@@ -8,7 +8,6 @@ class Job(models.Model):
survey_id = fields.Many2one(
'survey.survey', "Interview Form",
domain=[('category', '=', 'hr_recruitment')],
help="Choose an interview form for this job position and you will be able to print/answer this interview from all applicants who apply for this job")
def action_print_survey(self):
@@ -1,9 +0,0 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class Survey(models.Model):
_inherit = 'survey.survey'
category = fields.Selection(selection_add=[('hr_recruitment', 'Recruitment')])
@@ -9,7 +9,7 @@
<label for="survey_id" groups="survey.group_survey_user"/>
<div groups="survey.group_survey_user" class="o_row">
<field name="survey_id"
context="{'default_category': 'hr_recruitment', 'default_access_mode': 'token'}"/>
context="{'default_access_mode': 'token'}"/>
<button string="Display Interview Form" name="action_print_survey" type="object" attrs="{'invisible':[('survey_id','=',False)]}" class="oe_link"/>
</div>
</xpath>
@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo><data>
<record id="survey_survey_view_form" model="ir.ui.view">
<field name="name">survey.survey.view.form.inherit.hr_recruitment</field>
<field name="model">survey.survey</field>
<field name="inherit_id" ref="survey.survey_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='category']" position="attributes">
<attribute name="invisible">0</attribute>
</xpath>
</field>
</record>
</data></odoo>
+1 -2
View File
@@ -182,7 +182,6 @@ class Survey(http.Controller):
def _prepare_retry_additional_values(self, answer):
return {
'input_type': answer.input_type,
'deadline': answer.deadline,
}
@@ -524,7 +523,7 @@ class Survey(http.Controller):
Survey = request.env['survey.survey']
result = []
if question.question_type == 'multiple_choice':
result.append({'key': ustr(question.question),
result.append({'key': ustr(question.title),
'values': Survey.prepare_result(question, current_filters)['answers']
})
if question.question_type == 'simple_choice':
+1 -1
View File
@@ -16,7 +16,7 @@
We are conducting a survey and your response would be appreciated.
% endif
<div style="margin: 16px 0px 16px 0px;">
<a href="${('%s?answer_token=%s' % (object.survey_id.public_url, object.token)) | safe}"
<a href="${(object.get_start_url()) | safe}"
style="background-color: #875A7B; padding: 8px 16px 8px 16px; text-decoration: none; color: #fff; border-radius: 5px; font-size:13px;">
% if object.survey_id.certificate:
Start Certification
@@ -312,7 +312,6 @@
<record model="survey.user_input" id="survey_vendor_certification_answer_1">
<field name="survey_id" ref="survey.vendor_certification" />
<field name="input_type">manually</field>
<field name="partner_id" ref="base.res_partner_address_3"/>
<field name="email">douglas.fletcher51@example.com</field>
<field name="state">done</field>
@@ -329,7 +328,6 @@
</record>
<record model="survey.user_input" id="survey_vendor_certification_answer_2">
<field name="survey_id" ref="survey.vendor_certification" />
<field name="input_type">manually</field>
<field name="partner_id" ref="base.res_partner_address_7"/>
<field name="email">billy.fox45@example.com</field>
<field name="state">done</field>
@@ -346,7 +344,6 @@
</record>
<record model="survey.user_input" id="survey_vendor_certification_answer_3">
<field name="survey_id" ref="survey.vendor_certification" />
<field name="input_type">manually</field>
<field name="partner_id" ref="base.res_partner_address_15"/>
<field name="email">brandon.freeman55@example.com</field>
<field name="state">done</field>
@@ -363,7 +360,6 @@
</record>
<record model="survey.user_input" id="survey_vendor_certification_answer_4">
<field name="survey_id" ref="survey.vendor_certification" />
<field name="input_type">manually</field>
<field name="partner_id" ref="base.res_partner_address_25"/>
<field name="email">oscar.morgan11@example.com</field>
<field name="state">done</field>
@@ -198,28 +198,24 @@
<record model="survey.user_input" id="survey_answer_1">
<field name="survey_id" ref="survey.survey_feedback" />
<field name="input_type">manually</field>
<field name="partner_id" ref="base.partner_demo"/>
<field name="email">mark.brown23@example.com</field>
<field name="state">done</field>
</record>
<record model="survey.user_input" id="survey_answer_2">
<field name="survey_id" ref="survey.survey_feedback" />
<field name="input_type">manually</field>
<field name="partner_id" ref="base.res_partner_address_7"/>
<field name="email">billy.fox45@example.com</field>
<field name="state">done</field>
</record>
<record model="survey.user_input" id="survey_answer_3">
<field name="survey_id" ref="survey.survey_feedback" />
<field name="input_type">manually</field>
<field name="partner_id" eval="False"/>
<field name="email">Evelyne Gargouillis &lt;evelyne@example.com&gt;</field>
<field name="state">done</field>
</record>
<record model="survey.user_input" id="survey_answer_4">
<field name="survey_id" ref="survey.survey_feedback" />
<field name="input_type">manually</field>
<field name="partner_id" eval="False"/>
<field name="email">Martin Tamarre &lt;martin@example.com&gt;</field>
<field name="state">skip</field>
-1
View File
@@ -1,7 +1,6 @@
# -*- encoding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import ir_autovacuum
from . import survey_survey
from . import survey_question
from . import survey_user
-13
View File
@@ -1,13 +0,0 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class AutoVacuum(models.AbstractModel):
_inherit = 'ir.autovacuum'
@api.model
def power_on(self, *args, **kwargs):
self.env['survey.user_input'].do_clean_emptys()
return super(AutoVacuum, self).power_on(*args, **kwargs)
+1 -2
View File
@@ -37,7 +37,7 @@ class SurveyQuestion(models.Model):
"""
_name = 'survey.question'
_description = 'Survey Question'
_rec_name = 'question'
_rec_name = 'title'
_order = 'sequence,id'
@api.model
@@ -49,7 +49,6 @@ class SurveyQuestion(models.Model):
# question generic data
title = fields.Char('Title', required=True, translate=True)
question = fields.Char('Question', related="title")
description = fields.Html('Description', help="Use this field to add additional explanations about your question", translate=True)
survey_id = fields.Many2one('survey.survey', string='Survey', ondelete='cascade')
scoring_type = fields.Selection(related='survey_id.scoring_type', string='Scoring Type', readonly=True)
+22 -29
View File
@@ -3,10 +3,10 @@
import random
import uuid
import werkzeug
from collections import Counter, OrderedDict
from itertools import product
from werkzeug import urls
from odoo import api, fields, models, _
from odoo.exceptions import UserError
@@ -36,10 +36,6 @@ class Survey(models.Model):
('draft', 'Draft'), ('open', 'In Progress'), ('closed', 'Closed')
], string="Survey Stage", default='draft', required=True,
group_expand='_read_group_states')
category = fields.Selection([
('default', 'Generic Survey')], string='Category',
default='default', required=True,
help='Category is used to know in which context the survey is used. Various apps may define their own categories when they use survey like jobs recruitment or employee appraisal surveys.')
# questions
question_and_page_ids = fields.One2many('survey.question', 'survey_id', string='Sections and Questions', copy=True)
page_ids = fields.One2many('survey.question', string='Pages', compute="_compute_page_and_question_ids")
@@ -65,7 +61,6 @@ class Survey(models.Model):
users_login_required = fields.Boolean('Login Required', help="If checked, users have to login before answering even with a valid token.")
users_can_go_back = fields.Boolean('Users can go back', help="If checked, users can go back to previous pages.")
users_can_signup = fields.Boolean('Users can signup', compute='_compute_users_can_signup')
public_url = fields.Char("Public link", compute="_compute_survey_url")
# statistics
answer_count = fields.Integer("Registered", compute="_compute_survey_statistic")
answer_done_count = fields.Integer("Attempts", compute="_compute_survey_statistic")
@@ -150,12 +145,6 @@ class Survey(models.Model):
for survey in self:
survey.update(stat.get(survey._origin.id, default_vals))
def _compute_survey_url(self):
""" Computes a public URL for the survey """
base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
for survey in self:
survey.public_url = urls.url_join(base_url, "survey/start/%s" % (survey.access_token))
@api.depends('question_and_page_ids')
def _compute_page_and_question_ids(self):
for survey in self:
@@ -448,18 +437,6 @@ class Survey(models.Model):
def action_close(self):
self.write({'state': 'closed'})
def action_start_survey(self):
""" Open the website page with the survey form """
self.ensure_one()
token = self.env.context.get('survey_token')
trail = "?answer_token=%s" % token if token else ""
return {
'type': 'ir.actions.act_url',
'name': "Start Survey",
'target': 'self',
'url': self.public_url + trail
}
def action_send_survey(self):
""" Open a window to compose an email, pre-filled with the survey message """
# Ensure that this survey has at least one page with at least one question.
@@ -486,16 +463,26 @@ class Survey(models.Model):
'context': local_context,
}
def action_print_survey(self):
def action_start_survey(self, answer=None):
""" Open the website page with the survey form """
self.ensure_one()
url = '%s?%s' % (self.get_start_url(), werkzeug.urls.url_encode({'answer_token': answer.token or None}))
return {
'type': 'ir.actions.act_url',
'name': "Start Survey",
'target': 'self',
'url': url,
}
def action_print_survey(self, answer=None):
""" Open the website page with the survey printable view """
self.ensure_one()
token = self.env.context.get('survey_token')
trail = "?answer_token=%s" % token if token else ""
url = '%s?%s' % (self.get_print_url(), werkzeug.urls.url_encode({'answer_token': answer.token or None}))
return {
'type': 'ir.actions.act_url',
'name': "Print Survey",
'target': 'self',
'url': '/survey/print/%s%s' % (self.access_token, trail)
'url': url
}
def action_result_survey(self):
@@ -555,6 +542,12 @@ class Survey(models.Model):
'url': '/survey/%s/get_certification_preview' % (self.id)
}
def get_start_url(self):
return 'survey/start/%s' % self.access_token
def get_print_url(self):
return 'survey/print/%s' % self.access_token
# ------------------------------------------------------------
# GRAPH / RESULTS
# ------------------------------------------------------------
@@ -609,7 +602,7 @@ class Survey(models.Model):
labels = label
else:
labels = Label.browse([row_id, answer_id])
filter_display_data.append({'question_text': question.question,
filter_display_data.append({'question_text': question.title,
'labels': labels.mapped('value')})
return filter_display_data
+6 -16
View File
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import datetime
import logging
import uuid
@@ -24,9 +23,6 @@ class SurveyUserInput(models.Model):
scoring_type = fields.Selection(string="Scoring", related="survey_id.scoring_type")
start_datetime = fields.Datetime('Start date and time', readonly=True)
deadline = fields.Datetime('Deadline', help="Datetime until customer can open the survey and submit answers")
input_type = fields.Selection([
('manually', 'Manual'), ('link', 'Invitation')],
string='Answer Type', default='manually', required=True, readonly=True)
state = fields.Selection([
('new', 'Not started yet'),
('skip', 'Partially completed'),
@@ -113,16 +109,6 @@ class SurveyUserInput(models.Model):
user_input.attempt_number = attempt_number
@api.model
def do_clean_emptys(self):
""" Remove empty user inputs that have been created manually
(used as a cronjob declared in data/survey_cron.xml)
"""
an_hour_ago = fields.Datetime.to_string(datetime.datetime.now() - datetime.timedelta(hours=1))
self.search([('input_type', '=', 'manually'),
('state', '=', 'new'),
('create_date', '<', an_hour_ago)]).unlink()
def action_resend(self):
partners = self.env['res.partner']
emails = []
@@ -175,9 +161,13 @@ class SurveyUserInput(models.Model):
if challenges:
Challenge._cron_update(ids=challenges.ids, commit=False)
def _get_survey_url(self):
def get_start_url(self):
self.ensure_one()
return '/survey/start/%s?answer_token=%s' % (self.survey_id.access_token, self.token)
return '%s?answer_token=%s' % (self.survey_id.get_start_url(), self.token)
def get_print_url(self):
self.ensure_one()
return '%s?answer_token=%s' % (self.survey_id.get_print_url(), self.access_token)
class SurveyUserInputLine(models.Model):
-1
View File
@@ -191,7 +191,6 @@ class TestSurveyCommon(common.SavepointCase):
'survey_id': survey.id,
'partner_id': partner.id if partner else False,
'email': kwargs.pop('email', False),
'input_type': 'manually',
}
base_avals.update(kwargs)
return self.env['survey.user_input'].create(base_avals)
@@ -167,7 +167,7 @@
<field name="arch" type="xml">
<tree string="Survey Question" create="false">
<field name="sequence" widget="handle"/>
<field name="question"/>
<field name="title"/>
<field name="survey_id"/>
<field name="question_type"/>
</tree>
@@ -178,11 +178,11 @@
<field name="model">survey.question</field>
<field name="arch" type="xml">
<search string="Search Question">
<field name="question" string="Question"/>
<field name="title"/>
<field name="survey_id" string="Survey"/>
<field name="question_type" string="Type"/>
<group expand="1" string="Group By">
<filter name="group_by_type" string="Type" domain="[]" context="{'group_by':'question_type'}"/>
<filter name="group_by_type" string="Type" domain="[]" context="{'group_by':'question_type'}"/>
</group>
</search>
</field>
@@ -221,8 +221,10 @@
<field name="model">survey.label</field>
<field name="arch" type="xml">
<search string="Search Label">
<field name="question_id" string="Question"/>
<filter name="group_by_question" string="Question" domain="[]" context="{'group_by':'question_id'}"/>
<field name="question_id"/>
<group expand="1" string="Group By">
<filter name="group_by_question" string="Question" domain="[]" context="{'group_by':'question_id'}"/>
</group>
</search>
</field>
</record>
@@ -49,7 +49,6 @@
<group>
<group>
<field name="active" invisible="1"/>
<field name="category" invisible="1"/>
</group>
</group>
<notebook>
@@ -244,7 +243,6 @@
<filter invisible="1" string="Upcoming Activities" name="activities_upcoming_all"
domain="[('activity_ids.date_deadline', '&gt;', context_today().strftime('%Y-%m-%d'))]"/>
<group expand="0" string="Group By">
<filter string="Category" name="groupby_category" context="{'group_by': 'category'}"/>
<filter string="State" name="groupby_state" context="{'group_by': 'state'}"/>
</group>
</search>
+2 -2
View File
@@ -172,7 +172,7 @@
<t t-set="answer_lines" t-value="answer.user_input_line_ids.filtered(lambda line: line.question_id == question)"/>
<div class="js_question-wrapper" t-att-id="question.id">
<h4>
<span t-field='question.question' />
<span t-field='question.title' />
<span t-if="question.constr_mandatory" class="text-danger">*</span>
</h4>
<div t-field='question.description' class="text-muted oe_no_empty"/>
@@ -372,7 +372,7 @@
<t t-set="answer_lines" t-value="answer.user_input_line_ids.filtered(lambda line: line.question_id == question)"/>
<div class="js_question-wrapper" t-att-id="question.id">
<h2>
<span t-field='question.question' />
<span t-field='question.title'/>
<span t-if="question.constr_mandatory" class="text-danger">*</span>
<span t-if="quizz_correction" class="badge badge-pill" t-att-data-score-question="question.id"></span>
</h2>
@@ -50,7 +50,7 @@
<t t-set="question_with_correct_answers" t-value="survey.scoring_type in ['scoring_with_answers', 'scoring_without_answers'] and question.question_type in ['simple_choice', 'multiple_choice']" />
<h4>
<b>Question </b>
<span t-field='question.question'></span>
<span t-field='question.title'></span>
<t t-if="question.question_type == 'matrix'">
<small><span class="badge badge-secondary">Matrix: <span t-field='question.matrix_subtype'/></span></small>
</t>
@@ -14,8 +14,6 @@
<filter string="Partially Completed" name="partially_completed" domain="[('state', '=', 'skip')]"/>
<filter string="New" name="new" domain="[('state', '=', 'new')]"/>
<separator/>
<filter string="Invite" name="invite" domain="[('input_type', '=', 'link')]"/>
<separator/>
<filter string="Quizz passed" name="quizz_passed" domain="[('quizz_passed','=', True)]"/>
<separator/>
<filter string="Test Entries" name="test" domain="[('test_entry','=', True)]"/>
@@ -46,7 +44,6 @@
<group>
<field name="survey_id"/>
<field name="create_date"/>
<field name="input_type"/>
<field name="is_attempts_limited" invisible="1"/>
<label for="attempt_number" string="Attempt n°" attrs="{'invisible': ['|', ('is_attempts_limited', '=', False), '|', ('test_entry', '=', True), ('state', '!=', 'done')]}"/>
<div attrs="{'invisible': ['|', ('is_attempts_limited', '=', False), '|', ('test_entry', '=', True), ('state', '!=', 'done')]}">
@@ -93,7 +90,6 @@
<field name="deadline"/>
<field name="partner_id"/>
<field name="email"/>
<field name="input_type" groups="base.group_no_one"/>
<field name="attempt_number" />
<field name="state"/>
<field name="test_entry" invisible="True"/>
@@ -112,7 +108,6 @@
<field name="create_date"/>
<field name="partner_id"/>
<field name="email"/>
<field name="input_type"/>
<field name="state"/>
<templates>
<t t-name="kanban-box">
@@ -121,7 +116,6 @@
<div class="o_kanban_record_headings">
<strong class="o_kanban_record_title"><t t-esc="record.survey_id.value"/></strong>
</div>
<span class="badge badge-pill"><t t-esc="record.input_type.value"/></span>
</div>
<div class="o_kanban_record_bottom">
<div class="oe_kanban_bottom_left">
+8 -2
View File
@@ -3,6 +3,7 @@
import logging
import re
import werkzeug
from odoo import api, fields, models, tools, _
from odoo.exceptions import UserError
@@ -65,7 +66,7 @@ class SurveyInvite(models.TransientModel):
mail_server_id = fields.Many2one('ir.mail_server', 'Outgoing mail server')
# survey
survey_id = fields.Many2one('survey.survey', string='Survey', required=True)
survey_url = fields.Char(related="survey_id.public_url", readonly=True)
survey_start_url = fields.Char('Survey URL', compute='_compute_survey_start_url')
survey_access_mode = fields.Selection(related="survey_id.access_mode", readonly=True)
survey_users_login_required = fields.Boolean(related="survey_id.users_login_required", readonly=True)
survey_users_can_signup = fields.Boolean(related='survey_id.users_can_signup')
@@ -99,6 +100,12 @@ class SurveyInvite(models.TransientModel):
self.existing_text = existing_text
@api.depends('survey_id.access_token')
def _compute_survey_start_url(self):
base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
for invite in self:
invite.survey_start_url = werkzeug.urls.url_join(base_url, invite.survey_id.get_start_url()) if invite.survey_id else False
@api.onchange('emails')
def _onchange_emails(self):
if self.emails and (self.survey_users_login_required and not self.survey_id.users_can_signup):
@@ -187,7 +194,6 @@ class SurveyInvite(models.TransientModel):
def _get_answers_values(self):
return {
'input_type': 'link',
'deadline': self.deadline,
}
+1 -1
View File
@@ -13,7 +13,7 @@
<field name="survey_users_can_signup" invisible="1"/>
<field name="survey_id" readonly="context.get('default_survey_id')"/>
<field name="existing_mode" widget="radio" invisible="1" />
<field name="survey_url" label="Public share URL" readonly="1" widget="CopyClipboardChar"
<field name="survey_start_url" label="Public share URL" readonly="1" widget="CopyClipboardChar"
attrs="{'invisible':[('survey_access_mode', '!=', 'public')]}"
class="mb16"/>
<field name="partner_ids"
@@ -107,7 +107,6 @@
<record model="survey.user_input" id="furniture_certification_answer_1">
<field name="survey_id" ref="website_slides_survey.furniture_certification" />
<field name="input_type">manually</field>
<field name="partner_id" ref="base.res_partner_address_3"/>
<field name="email">douglas.fletcher51@example.com</field>
<field name="state">done</field>
@@ -119,7 +118,6 @@
</record>
<record model="survey.user_input" id="furniture_certification_answer_2">
<field name="survey_id" ref="website_slides_survey.furniture_certification" />
<field name="input_type">manually</field>
<field name="partner_id" ref="base.res_partner_address_7"/>
<field name="email">billy.fox45@example.com</field>
<field name="state">done</field>
@@ -103,7 +103,7 @@ class Slide(models.Model):
last_user_input = next(user_input for user_input in user_membership_id_sudo.user_input_ids.sorted(
lambda user_input: user_input.create_date, reverse=True
))
certification_urls[slide.id] = last_user_input._get_survey_url()
certification_urls[slide.id] = last_user_input.get_start_url()
else:
user_input = slide.survey_id.sudo()._create_answer(
partner=self.env.user.partner_id,
@@ -114,7 +114,7 @@ class Slide(models.Model):
},
invite_token=self.env['survey.user_input']._generate_invite_token()
)
certification_urls[slide.id] = user_input._get_survey_url()
certification_urls[slide.id] = user_input.get_start_url()
else:
user_input = slide.survey_id.sudo()._create_answer(
partner=self.env.user.partner_id,
@@ -123,5 +123,5 @@ class Slide(models.Model):
'slide_id': slide.id
}
)
certification_urls[slide.id] = user_input._get_survey_url()
certification_urls[slide.id] = user_input.get_start_url()
return certification_urls