Hello every one ! hope you're doing well
i'm a beginner in odoo and i'm facing some issues hope you nice people could help me ,
i'm trying to add a binary field or attachment (any type of field that will allow me to upload a file ) in my details form in the customer.
first i added a binary field with attachment=True and inherited the "portal.portal_my_details" template added my fields and i added them in the MANDATORY_BILLING_FIELDS and now i can update the values exept for the binary field whenever i try to update the values dictionary mentions that str has no attribute read i don't know if i got things right but i did logged the dictionary and the type(post.get('my binary field')) returns str i don't undersatnd i just need to upload a file in the customer portal form
thank you for you help and time
It would make more sense if you will share your code also.
Try to follow these tips: https://sites.google.com/view/thinkincode/erp/odoo
In fact i solved the issue here's what i did if anyone may need this in the futur
1/ first i inherited the res.partner and added my binary field as follow :
field = fields.binary(string="my field")
2/ next i ingerited the portal.portal_my_details view and added my field as <input type="file"> without forgetting to add the attribute <attribute name="enctype">multipart/form-data</attribute> to the form in the template
3/ last step was to inherit the CustomerPortal class in the portal controller and this is where i encoded the file by doing this at the begining befor updation the values dict :
content = post.get('content')
FileData = content.read()
file_base64 = base64.encodestring(FileData)
and it worked perfectly
thank you hope it helps