[FIX] website_form: set filename on studio binary
Using studio, add a file field on a form. Using the web form builder, append that field on a form. Upload a file, `x_field_filename` is left empty thus the filename is lost. opw-2028071 closes odoo/odoo#34491 Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
This commit is contained in:
@@ -129,6 +129,8 @@ class WebsiteForm(http.Controller):
|
||||
# If it's not, we'll use attachments instead
|
||||
if field_name in authorized_fields and authorized_fields[field_name]['type'] == 'binary':
|
||||
data['record'][field_name] = base64.b64encode(field_value.read())
|
||||
if authorized_fields[field_name]['manual']:
|
||||
data['record'][field_name + "_filename"] = field_value.filename
|
||||
else:
|
||||
field_value.field_name = field_name
|
||||
data['attachments'].append(field_value)
|
||||
|
||||
Reference in New Issue
Block a user