Skip to content
Extraits de code Groupes Projets
Valider ceb99a32 rédigé par Juliana's avatar Juliana
Parcourir les fichiers

[ADD] Add notif to answers done + send mail when answers done

parent 29c18242
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -49,6 +49,11 @@ class WebsiteSurveyExtend(Survey):
vals = {'last_displayed_page_id': page_id}
if next_page is None and not go_back:
vals.update({'state': 'done'})
if user_input.survey_id.is_mail_auto:
# Send mail auto if survey configurated
user_input.action_send_mail()
# Send notification to followers
survey.message_post(body="Sondage terminé", message_type="notification", subtype="ethikis_survey.survey_state_change")
else:
vals.update({'state': 'skip'})
user_input.sudo(user=user_id).write(vals)
......
......@@ -38,7 +38,7 @@ class Survey(models.Model):
def _track_subtype(self, init_values):
self.ensure_one()
if (('stage_id' in init_values) and (self.stage_id.name == "Fermé")):
if (('stage_id' in init_values) and (self.stage_id.name == "Terminé")):
return 'ethikis_survey.survey_state_change'
return super(Survey, self)._track_subtype(init_values)
......@@ -92,13 +92,6 @@ class SurveyUserInput(models.Model):
'url': '/survey/%s/%s/%s' % (url_tag, self.survey_id.id, self.token)
}
@api.onchange('state')
def on_change_state(self):
# At the end of the survey, send a mail if survey is configured for that
if self.state == 'done':
if self.survey_id.is_mail_auto:
self.action_send_mail()
@api.multi
def action_send_mail(self):
self.ensure_one()
......
......@@ -185,14 +185,57 @@ input[type=range] {
input[type=range]:focus {
outline: none;
}
input[type=range]::-ms-track {
width: 100%;
height: 4px;
cursor: pointer;
animate: 0.2s;
background: #61C4E1;
background-color: #61C4E1;
border-radius: 25px;
}
input[type=range]::-moz-range-track {
width: 100%;
height: 4px;
cursor: pointer;
animate: 0.2s;
background: #61C4E1;
background-color: #61C4E1;
border-radius: 25px;
}
input[type=range]::-webkit-slider-runnable-track {
width: 100%;
height: 4px;
cursor: pointer;
animate: 0.2s;
background: #61C4E1;
background-color: #61C4E1;
border-radius: 25px;
}
input[type=range]::-moz-range-thumb{
height: 20px;
width: 20px;
border-radius: 50%;
background: #fff;
box-shadow: 0 0 4px 0 rgba(0,0,0, 1);
cursor: pointer;
-webkit-appearance: none;
margin-top: -8px;
}
input[type=range]::-ms-thumb{
height: 20px;
width: 20px;
border-radius: 50%;
background: #fff;
box-shadow: 0 0 4px 0 rgba(0,0,0, 1);
cursor: pointer;
-webkit-appearance: none;
margin-top: -8px;
}
input[type=range]::-webkit-slider-thumb {
height: 20px;
width: 20px;
......@@ -203,9 +246,20 @@ input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
margin-top: -8px;
}
input[type=range]:focus::-ms-track{
background: #61C4E1;
background-color: #61C4E1;
}
input[type=range]:focus::-moz-range-track{
background: #61C4E1;
background-color: #61C4E1;
}
input[type=range]:focus::-webkit-slider-runnable-track {
background: #61C4E1;
background-color: #61C4E1;
}
.range-wrap{
position: relative;
}
......@@ -246,7 +300,7 @@ input[type=range]:focus::-webkit-slider-runnable-track {
box-shadow: 0 0 0 0.2rem rgba(0, 160, 157, 0);
}
.form-control {
input#range{
background-color: transparent !important;
border: 0px solid #ced4da !important;
}
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter