diff options
| author | Fanny He <fah@odoo.com> | 2019-11-29 08:08:36 +0000 |
|---|---|---|
| committer | Fanny He <fah@odoo.com> | 2019-11-29 10:55:09 +0000 |
| commit | 58b7907254ab9ef49f62b97f16a98cfbdfd0f9fe (patch) | |
| tree | dfb625dac272dbd1bfe8b460463016aaa808eee7 /addons/website_form | |
| parent | 4876dd7906a7a96c7e782638a1cb04ee44923e7d (diff) | |
[FIX] website_form: link attachments to binary fields
If the name of a file input field is 'x_binary_input', before
commit 9be29371abcdfe57b1738484c5057ad81e76b00d (opw 2092653),
self.form_fields would have names of the form 'x_binary_input[i]'.
After this commit, they are of the form 'x_binary_input[i][j]'.
When calling extract_data, field_name would then be 'x_binary_input[i]'
instead of 'x_binary_input'. Therefore, the file would be considered as orphan
instead of being attached to x_binary_input.
We thus change the split so that it always returns 'x_binary_input'.
opw 2122624
closes odoo/odoo#41135
X-original-commit: 21ed2b971f66879fa3fa53dbd2c349ab39fa3fdb
Signed-off-by: fah-odoo <fah-odoo@users.noreply.github.com>
Diffstat (limited to 'addons/website_form')
| -rw-r--r-- | addons/website_form/controllers/main.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/website_form/controllers/main.py b/addons/website_form/controllers/main.py index b2688c76c7e..02f9bf863a0 100644 --- a/addons/website_form/controllers/main.py +++ b/addons/website_form/controllers/main.py @@ -122,7 +122,7 @@ class WebsiteForm(http.Controller): # If the value of the field if a file if hasattr(field_value, 'filename'): # Undo file upload field name indexing - field_name = field_name.rsplit('[', 1)[0] + field_name = field_name.split('[', 1)[0] # If it's an actual binary field, convert the input file # If it's not, we'll use attachments instead |
