fix bugs ion odoo 19
This commit is contained in:
parent
66553b3ebd
commit
abf03aa5b9
@ -1,13 +1,26 @@
|
|||||||
/** @odoo-module */
|
/** @odoo-module */
|
||||||
import SurveyFormWidget from '@survey/js/survey_form';
|
import { SurveyForm } from "@survey/interactions/survey_form";
|
||||||
SurveyFormWidget.include({
|
import { patch } from "@web/core/utils/patch";
|
||||||
/** Get all question answers by question type */
|
|
||||||
_prepareSubmitValues(formData, params) {
|
patch(SurveyForm.prototype, {
|
||||||
this._super(...arguments);
|
/**
|
||||||
this.$('[data-question-type]').each(function () {
|
* @override
|
||||||
if ($(this).data('questionType') === 'upload_file'){
|
*/
|
||||||
params[this.name] = [$(this).data('oe-data'), $(this).data('oe-file_name')];
|
prepareSubmitValues(formData, params) {
|
||||||
}
|
super.prepareSubmitValues(formData, params);
|
||||||
|
|
||||||
|
// Handle upload_file question type
|
||||||
|
this.el.querySelectorAll('[data-question-type="upload_file"]').forEach((el) => {
|
||||||
|
const oeData = el.getAttribute('data-oe-data');
|
||||||
|
const oeFileName = el.getAttribute('data-oe-file_name');
|
||||||
|
if (oeData && oeFileName) {
|
||||||
|
try {
|
||||||
|
params[el.name] = [JSON.parse(oeData), JSON.parse(oeFileName)];
|
||||||
|
} catch (e) {
|
||||||
|
// Fallback if not valid JSON
|
||||||
|
params[el.name] = [oeData, oeFileName];
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
/** @odoo-module */
|
/** @odoo-module */
|
||||||
import publicWidget from "@web/legacy/js/public/public_widget";
|
import publicWidget from "@web/legacy/js/public/public_widget";
|
||||||
import SurveyFormWidget from '@survey/js/survey_form';
|
|
||||||
import SurveyPreloadImageMixin from "@survey/js/survey_preload_image_mixin";
|
import SurveyPreloadImageMixin from "@survey/js/survey_preload_image_mixin";
|
||||||
/** Extends publicWidget to create "SurveyFormUpload" */
|
/** Extends publicWidget to create "SurveyFormUpload" */
|
||||||
publicWidget.registry.SurveyFormUpload = publicWidget.Widget.extend(SurveyPreloadImageMixin, {
|
publicWidget.registry.SurveyFormUpload = publicWidget.Widget.extend(SurveyPreloadImageMixin, {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user