[ADD] web: Add a new widget to attach documents on a record

Purpose
=======

Add the possibility to easily attach a document on a record. That could be used for to attach receipts on expense for example.

Specification
=============

Add a new widget (AttachDocument) to allow attach document from mobile/web directly on record form

After attaching document it will call action given on widget, that action will be a method name on given model
This commit is contained in:
jpr-odoo
2018-02-09 06:59:56 +01:00
committed by Yannick Tivisse
parent dfdc06fe43
commit b7aa439826
6 changed files with 178 additions and 1 deletions
+16
View File
@@ -1351,4 +1351,20 @@
</div>
</t>
<t t-name="AttachDocument">
<button class="btn btn-sm btn-default o_attachment_button">
<span class="o_attach_document"><t t-esc="widget.node.attrs.string"/></span>
<span class="hide">
<t t-call="HiddenInputFile">
<t t-set="fileupload_id" t-value="widget.fileuploadID"/>
<t t-set="fileupload_action" t-translation="off">/web/binary/upload_attachment</t>
<t t-set="multi_upload" t-value="true"/>
<input type="hidden" name="model" t-att-value="widget.res_model"/>
<input type="hidden" name="id" t-att-value="widget.res_id"/>
<input type="hidden" name="session_id" t-att-value="widget.getSession().session_id"/>
</t>
</span>
</button>
</t>
</templates>