Thanks Yenthe. The code I am using to write through the
execute('res.partner', 'write', [6], {'image': imageBase64})
Or using OdooRPC
model.browse(6).write({'image': imageBase64)
In both cases I get the following error:
xmlrpc.client.Fault: <Fault 'Binary' object is not subscriptable: 'Traceback (most recent call last):
File "/home/odoo/odoo12/odoo/odoo/addons/base/controllers/rpc.py", line 60, in xmlrpc_1
response = self._xmlrpc(service)
File "/home/odoo/odoo12/odoo/odoo/addons/base/controllers/rpc.py", line 49, in _xmlrpc
result = dispatch_rpc(service, method, params)
File "/home/odoo/odoo12/odoo/odoo/http.py", line 120, in dispatch_rpc
result = dispatch(method, params)
File "/home/odoo/odoo12/odoo/odoo/service/model.py", line 40, in dispatch
res = fn(db, uid, *params)
File "/home/odoo/odoo12/odoo/odoo/service/model.py", line 98, in wrapper
return f(dbname, *args, **kwargs)
File "/home/odoo/odoo12/odoo/odoo/service/model.py", line 185, in execute
res = execute_cr(cr, uid, obj, method, *args, **kw)
File "/home/odoo/odoo12/odoo/odoo/service/model.py", line 169, in execute_cr
result = odoo.api.call_kw(recs, method, args, kw)
File "/home/odoo/odoo12/odoo/odoo/api.py", line 759, in call_kw
return _call_kw_multi(method, model, args, kwargs)
File "/home/odoo/odoo12/odoo/odoo/api.py", line 746, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/home/odoo/odoo12/odoo/addons/partner_autocomplete/models/res_partner.py", line 183, in write
res = super(ResPartner, self).write(values)
File "/home/odoo/odoo12/odoo/odoo/addons/base/models/res_partner.py", line 563, in write
tools.image_resize_images(vals, sizes={'image': (1024, None)})
File "/home/odoo/odoo12/odoo/odoo/tools/image.py", line 302, in image_resize_images
vals.update(image_get_resized_images(vals[big_name],
File "/home/odoo/odoo12/odoo/odoo/tools/image.py", line 292, in image_get_resized_images
return_dict[big_name] = image_resize_image_big(base64_source, avoid_if_small=avoid_resize_big, size=size_big)
File "/home/odoo/odoo12/odoo/odoo/tools/image.py", line 168, in image_resize_image_big
return image_resize_image(base64_source, size, encoding, filetype, avoid_if_small)
File "/home/odoo/odoo12/odoo/odoo/tools/image.py", line 66, in image_resize_image
if size == (None, None) or base64_source[:1] == b'P':
TypeError: 'Binary' object is not subscriptable
Any advice to overcome this problem please?
Thanks Andres
Check odoo customization tips: https://learnopenerp.tumblr.com/
Hope this will helps
@Sehrish.. Thank you for your quick response.
Unfortunately the link doesn't contain any information about XML RPC which is what i'm trying to use to upload the images
Check this one: http://learnopenerp.blogspot.com/2019/10/connecting-to-odoo-using-xml-rpc.html