Hi, I'm working on a job application which requires a survey
what I need to do is to add  pictures as part of a multiple choice question on a quiz, how can I add it?
Odoo is the world's easiest all-in-one management software.
 It includes hundreds of business apps:
Hi, I'm working on a job application which requires a survey
what I need to do is to add  pictures as part of a multiple choice question on a quiz, how can I add it?
Hi,Go to Survery -> Then Create a Question:Here we have an option to upload file as Image

Hope it helps
Youta,
in your python file
image = fields.Binary('Image')In xml
<field name="image" widget="image"/>
well, I tried to add it myself, but I got an error of:
Integrity Error
The operation cannot be completed, probably due to the following:
- deletion: you may be trying to delete a record while other records still reference it- creation/update: a mandatory field is not correctly set
[object with reference: page_id - page.id]
Here's my code:
class survey_question(osv.osv):
_inherit = 'survey.question'
def _get_image(self, cr, uid, ids, name, args, context=None):
result = dict.fromkeys(ids, False) for obj in self.browse(cr, uid, ids, context=context):
result[obj.id] = tools.image_get_resized_images(obj.image) return result
def _set_image(self, cr, uid, id, name, value, args, context=None):
return self.write(cr, uid, [id], {'image': tools.image_resize_image_big(value)}, context=context)
_columns = { 'image': fields.binary("Photo", help="This field holds the image used as photo for the question, limited to 1024x1024px."), 'image_medium': fields.function(_get_image, fnct_inv=_set_image, string="Medium-sized photo", type="binary", multi="_get_image", store = { 'survey.question': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10), }, help="Medium-sized photo. It is automatically "\ "resized as a 128x128px image, with aspect ratio preserved. "\ "Use this field in form views or some kanban views."), 'image_small': fields.function(_get_image, fnct_inv=_set_image, string="Small-sized photo", type="binary", multi="_get_image", store = { 'survey.question': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10), }, help="Small-sized photo. It is automatically "\ "resized as a 64x64px image, with aspect ratio preserved. "\ "Use this field anywhere a small image is required."),
}
Hello Again Youta !
IMHO, I think it is not easy do add such thing to the survey module "I mean, this is not direct and straight forward such as normal models',
You can take a look at the OCA survey contribution , and you can also check this module it adds a new type of questions to survey ...
Hope this could helps a little bit ..
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อ| Related Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
|---|---|---|---|---|
|  | 3 ก.ย. 24  | 5963 | ||
|  | 2 มี.ค. 24  | 4058 | ||
|  | 1 มี.ค. 24  | 2394 | ||
|  | 0 ก.ย. 23  | 1759 | ||
| 
            
                Duplicate question in surveys
            
            
                    แก้ไขแล้ว
            
         |  | 2 พ.ค. 23  | 2617 |