Hello,
a freelancer wrote month go a module, to add other images to a product.
I have this in my form view:
<field name="other_image_ids" widget="one2many_list" modifiers="{}"/>
When I made a new entry in the list, I have:
id: image, typ binary
id: name, typ char
id: sequence, type integer
id: description, type text
I have of course access to all files of the module.
I have a similar module, where I can add url for file downloads. This is in my import module:
if row['files']:
downloads = row['files']['downloads']
files = []
for f in downloads:
type = self.env['product.file.type'].search([('name', '=', f['type'])], limit=1)
if type and type.name == 'Datasheet':
skip_dt = True
if not type:
logger.error('************* File Type %s does not exists **************' % (f['type']))
for link in f['link']:
files.append((0,0, {'file_url': link,
'file_type_id': type.id}))
vals.update({'file_ids': files})
The datas come from a json with the id: otherImages. In the json the image is as base64 stored.
Can someone post please post the code to import the otherImages?
Thank you!