I am working on Hr_Recruitment module.I have added a binary image field for HR->Application.I am trying to add functionality for external user to fill the job application them self through website.I have added name,email,phone,resume attachment fields in website for Job application.when they click on submit, it is updating in HR->Job Application Form.But Image field is not getting updated in Application.When opening the job application It is showing message like "Could not show the selected image".How to solve this issue?
controller/main.py
if post.get('image',False):
image = request.registry['ir.attachment']
name = post.get('image').filename
file = post.get('image')
attach = file.stream
file.show()
f = attach.getvalue()
webbrowser.open(image)
attachment_id = Attachments.create(request.cr, request.uid, {
'name': image,
'res_name': image,
'res_model': 'hr.applicant',
'res_id': applicant_id,
'datas': base64.decodestring(str(res[0])),
'datas_fname': post['image'].filename,
}, request.context)
views/templates.xml
<div t-attf-class="form-group">
<label class="col-md-3 col-sm-4 control-label" for="image">Image</label>
<div class="col-md-7 col-sm-8">
<img id="uploadPreview" style="width: 100px; height: 100px;" />
<input id="uploadImage" name="image" type="file" class="file" multiple="true" data-show-upload="true" data-show-caption="true" data-show-preview="true" onchange="PreviewImage();"/>
</div>
</div>


Add the image field as shown below in your XML template:
remove the unnecessary attributes for you.
And in your controller function, you can get the value from the image fields as:
The above code works for me, I have been using this to update partner images from ODOO website.