Если вы хотите удалить кнопку для всего виджета Binary field в Odoo, вы можете просто «расширить» шаблон QWeb для этого виджета, а именно:
<t t-name="FieldBinaryFile">
<a t-if="widget.mode === 'readonly'" href="javascript:void(0)" class="o_form_uri"/>
<div t-if="widget.mode !== 'readonly'" class="o_field_binary_file">
<input type="text" class="o_input"
readonly="readonly"
t-att-name="widget.name"
t-att-tabindex="widget.attrs.tabindex"
t-att-autofocus="widget.attrs.autofocus"/>
<button type="button" class="btn btn-sm btn-primary o_select_file_button" title="Select">Upload your file</button>
<button type="button" class="btn btn-sm btn-default fa fa-pencil o_select_file_button" title="Select"/>
<button type="button" class="btn btn-sm btn-default fa fa-trash-o o_clear_file_button" title="Clear"/>
<span class="o_form_binary_progress">Uploading...</span>
<t t-call="HiddenInputFile">
<t t-set="fileupload_id" t-value="widget.fileupload_id"/>
<t t-set="fileupload_style" t-translation="off">overflow-x: hidden</t>
</t>
</div>
</t>
Вы можете расширить шаблоны QWeb, нозагружать их в файл манифеста под ключом qweb
.
xml файл обычно в модуле в / static / src / xml
<templates>
<t t-name="web.FieldBinaryFile" t-extend="base.FieldBinaryFile">
<t t-jquery="button[title='Clear']"
t-operation="replace" />
</t>
</templates>
и часть манифеста
{
'name': 'remove button in binary widget',
# and so on
'depends': [
'base',
],
'qweb': [
'static/src/xml/remove_button.xml'
],
# and so on
}