From fe301a3d02f10aba791245677a51d32ad5a83a73 Mon Sep 17 00:00:00 2001 From: "Thomas Lefebvre (thle)" Date: Wed, 6 Sep 2023 14:23:59 +0200 Subject: [PATCH] [FIX] web: display download button if not dirty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce: ------------------- For example: - add a work permit file to an employee (private information tab); - try to download it before saving; Issue: ------ The old file is downloaded or a traceback occurs if there was no file before. Cause: ------ When downloading, we use the `/web/content` endpoint. We will try to read the record in the backend via `_record_to_stream`. The record is not yet saved in database. Solution: --------- Disable download button if record is dirty. opw-3458842 closes odoo/odoo#135405 X-original-commit: 3557e66a410428b877213508104e9accbbfdaf20 Signed-off-by: Michaƫl Mattiello (mcm) --- .../src/views/fields/binary/binary_field.xml | 2 +- .../tests/views/fields/binary_field_tests.js | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/views/fields/binary/binary_field.xml b/addons/web/static/src/views/fields/binary/binary_field.xml index 51b4fc16203..c2f6fdb34d2 100644 --- a/addons/web/static/src/views/fields/binary/binary_field.xml +++ b/addons/web/static/src/views/fields/binary/binary_field.xml @@ -9,7 +9,7 @@ acceptedFileExtensions="props.acceptedFileExtensions" onUploaded.bind="update" > - +