OCA / survey

Survey addons
GNU Affero General Public License v3.0
27 stars 111 forks source link

survey_question_type_binary reestructured #132

Open adasatorres opened 2 weeks ago

adasatorres commented 2 weeks ago

Good morning, while I was developing a functionality for the survey module, I noticed that the survey_question_type_binary add-on does not follow the same logic as the other standard Odoo questions, which complicates certain developments. I suggest restructuring the add-on to standardize the code and avoid future issues with other add-ons.

My suggestion would be in the survey_form.js file. I don't think the _submitForm method should be overridden, but rather the _prepareSubmitValues method should be.

Have a great day!

pedrobaeza commented 2 weeks ago

Yes, I agree

mando-way-this-is-the-way-289831086

adasatorres commented 2 weeks ago

Good morning, the change I suggested has encountered a problem. The FileReader used to read the file's content is asynchronous, so all the previous methods should be asynchronous as well, including the _submitForm() method. Otherwise, the call to the controller will execute before the file information is obtained. I've noticed that in versions after 16, Odoo has already made this method asynchronous to avoid passing the promise to the nextScreen() method. However, they left the _prepareSubmitValues() method unchanged, I assume because the standard fields of the survey module don't use any asynchronous methods. Any suggestions?

pedrobaeza commented 2 weeks ago

Sorry, no clue. Maybe @chienandalu or @CarlosRoca13 can give you any hint.