Hi
First, you export the images field with the external id, eg you need to move the employee's images from v14 to 15
try
to export the external id and the image filed and after you must write a
wizard action and try to put the below code into it
from odoo import models, fields
import base64
import io
import csv
class DynamicField(models.TransientModel):
_name = 'import.photo'
_description = 'Import Photo'
file = fields.Binary('File')
def import_photo(self):
csv_data = base64.b64decode(self.file)
data_file = io.StringIO(csv_data.decode("utf-8"))
csv_reader = csv.reader(data_file, delimiter=',')
keys = ['id', 'photo']
file_reader = []
file_reader.extend(csv_reader)
for i in range(len(file_reader)):
field = list(map(str, file_reader[i]))
values = dict(zip(keys, field))
if values:
if i == 0:
continue
else:
employee = self.env.ref(values['id'])
employee.write({
'image_1920': values['photo']
})
XML:
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model='ir.ui.view' id='wizard_employee_photo_import'>
<field name="name">import.photo</field>
<field name="model">import.photo</field>
<field name="arch" type="xml">
<form string="Import">
<sheet>
<group>
<group string="Import">
<field name="file"/>
</group>
</group>
</sheet>
<footer>
<button name="import_photo" string="Import" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
Hope it helps