[FIX] web_editor: properly post process document upload

When using the media dialog, when uploading an image, the image list
refreshes itself properly. This was not the case for documents as it
was... refreshing the image list too instead of the document list. Also,
when uploading a document, it is supposed to be added in the page
directly and the media dialog is supposed to close. This feature was
broken for the same reason: the iframe system of both tabs which were
using the same name.

Bug introduced with https://github.com/odoo/odoo/commit/abde8bddf8ec45cf12aab59e95c330321158cfba
(even though is was technically wrong for the same reason before).

Closes https://github.com/odoo/odoo/pull/28722
This commit is contained in:
qsm-odoo
2018-11-15 17:07:32 +01:00
parent f3f20653d3
commit f1e999d33e
+3 -2
View File
@@ -79,11 +79,12 @@
<!-- Image choosing part of the Media Dialog -->
<t t-name="web_editor.dialog.image">
<t t-set="iframeName" t-value="_.uniqueId('fileframe-')"/>
<form class="form-inline"
method="POST"
action="/web_editor/attachment/add"
enctype="multipart/form-data"
target="fileframe">
t-att-target="iframeName">
<input type="hidden" name="csrf_token" t-att-value="csrf_token"/>
<input type="hidden" name="filters" t-att-value="widget.firstFilters.join('_')"/>
<input t-if="widget.options.res_id" type="hidden" name="res_id" t-att-value="widget.options.res_id"/>
@@ -118,7 +119,7 @@
<div class="existing-attachments">
<t t-call="web_editor.dialog.image.existing"/>
</div>
<iframe class="hidden" name="fileframe"/>
<iframe class="hidden" t-att-name="iframeName"/>
</form>
</t>
<t t-name="web_editor.dialog.image.existing">