diff options
| author | Julien Castiaux <juc@odoo.com> | 2019-07-01 13:20:51 +0000 |
|---|---|---|
| committer | Julien Castiaux <juc@odoo.com> | 2019-07-01 13:20:51 +0000 |
| commit | 0e2f3b144581c47d25a99cecdd7e058a3d55bcc3 (patch) | |
| tree | 513d668ee69f5304973b845a16bf8cbea8a25a47 /addons/website_form/controllers | |
| parent | 2d03ed43a5a0965bcab234b1a77589540440b1df (diff) | |
[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>
Diffstat (limited to 'addons/website_form/controllers')
| -rw-r--r-- | addons/website_form/controllers/main.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/addons/website_form/controllers/main.py b/addons/website_form/controllers/main.py index f8a75af3130..2d95523c082 100644 --- a/addons/website_form/controllers/main.py +++ b/addons/website_form/controllers/main.py @@ -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) |
