I am tried this function. Its not working for me in odoo 17. how to inherit and ovrride the _initTimer js function.
_initTimer: function () {
if (this.surveyTimerWidget) {
this.surveyTimerWidget.destroy();
}
var self = this;
var $timerData = this.$('.o_survey_form_content_data');
var questionTimeLimitReached = $timerData.data('questionTimeLimitReached');
var timeLimitMinutes = $timerData.data('timeLimitMinutes');
var hasAnswered = $timerData.data('hasAnswered');
const serverTime = $timerData.data('serverTime');
if (!questionTimeLimitReached && !hasAnswered && timeLimitMinutes) {
var timer = $timerData.data('timer');
var $timer = $('<span>', {
class: 'o_survey_timer'
});
this.$('.o_survey_timer_container').append($timer);
this.surveyTimerWidget = new publicWidget.registry.SurveyTimerWidget(this, {
'serverTime': serverTime,
'timer': timer,
'timeLimitMinutes': timeLimitMinutes
});
this.surveyTimerWidget.attachTo($timer);
this.surveyTimerWidget.on('time_up', this, function (ev) {
self._submitForm({
'skipValidation': true,
'isFinish': !this.options.sessionInProgress
});
});
}
},