diff options
| author | Nicolas Lempereur <nle@odoo.com> | 2020-02-19 18:20:15 +0000 |
|---|---|---|
| committer | Nicolas Lempereur <nle@odoo.com> | 2020-02-25 13:19:39 +0000 |
| commit | 36d4ff5c4c9e68a9b5eb2b2425670aecf2f9a53a (patch) | |
| tree | a3e6af71f1c0ee19971cf323dfc38db523ce2f99 /addons/website_form/controllers/main.py | |
| parent | 5da345449941fc843e27d87b8df7a619d2575c5c (diff) | |
[FIX] website_form: binary work with website_crm_phone_validation
With this change, a binary field in a website form works when
website_crm_phone_validation (website_crm in 13.0) is installed.
The module website_crm_phone_validation would call `extract_data` method
to do some things, but when extract_data was called a second time to
really save data, the FileStorage werkzeug object would already consumed
and files would erroneously appear as empty.
opw-2191873
closes odoo/odoo#46241
X-original-commit: a168fe23cc6d9b817b44c189822952a1ee98d81d
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Diffstat (limited to 'addons/website_form/controllers/main.py')
| -rw-r--r-- | addons/website_form/controllers/main.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/addons/website_form/controllers/main.py b/addons/website_form/controllers/main.py index a39ce5eaeb0..1e3614bf3d5 100644 --- a/addons/website_form/controllers/main.py +++ b/addons/website_form/controllers/main.py @@ -134,6 +134,7 @@ 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()) + field_value.stream.seek(0) # do not consume value forever if authorized_fields[field_name]['manual'] and field_name + "_filename" in dest_model: data['record'][field_name + "_filename"] = field_value.filename else: |
