Browse Source

Dec 26: [FIX] Bug Fixed 'survey_upload_file'

pull/309/head
Cybrosys Technologies 4 months ago
parent
commit
89699385fa
  1. 2
      survey_upload_file/__manifest__.py
  2. 5
      survey_upload_file/doc/RELEASE_NOTES.md
  3. 19
      survey_upload_file/models/survey_user_input.py

2
survey_upload_file/__manifest__.py

@ -21,7 +21,7 @@
############################################################################## ##############################################################################
{ {
'name': "File Upload In Survey", 'name': "File Upload In Survey",
'version': "17.0.1.0.0", 'version': "17.0.1.0.1",
'category': 'Extra Tools', 'category': 'Extra Tools',
'summary': 'Attachment of File in Survey Form', 'summary': 'Attachment of File in Survey Form',
'description': 'This module is used for attachments of file in Survey Form,' 'description': 'This module is used for attachments of file in Survey Form,'

5
survey_upload_file/doc/RELEASE_NOTES.md

@ -5,3 +5,8 @@
#### ADD #### ADD
- Initial Commit for File Upload In Survey - Initial Commit for File Upload In Survey
#### 23.12.2024
#### Version 17.0.1.0.1
#### Update
- Updated with the issue in index.

19
survey_upload_file/models/survey_user_input.py

@ -71,15 +71,16 @@ class SurveyUserInput(models.Model):
'answer_type': answer_type, 'answer_type': answer_type,
} }
if answer_type == 'upload_file': if answer_type == 'upload_file':
file_data = answer[0]
file_name = answer[1]
attachment_ids = [] attachment_ids = []
for file in range(len(answer[1])): if len(answer) >= 2:
attachment = self.env['ir.attachment'].create({ file_data = answer[0]
'name': file_name[file], file_name = answer[1]
'type': 'binary', for file in range(len(answer[1])):
'datas': file_data[file], attachment = self.env['ir.attachment'].create({
}) 'name': file_name[file],
attachment_ids.append(attachment.id) 'type': 'binary',
'datas': file_data[file],
})
attachment_ids.append(attachment.id)
vals['value_file_data_ids'] = attachment_ids vals['value_file_data_ids'] = attachment_ids
return vals return vals

Loading…
Cancel
Save