I am try to disable the clear button in attachment form. I think this is js code. I search some js code in but nothing find.
Any hint for this problem??
This is the image of clear button
Another approach for only extending this one form view is to set the field dynamically to readonly when filled.
<record id="view_attachment_form" model="ir.ui.view">
<field name="name">disable remove button if filled</field>
<field name="model">ir.attachment</field>
<field name="inherit_id" ref="base.view_attachment_form" />
<field name="arch" type="xml">
<field name="datas" position="attributes">
<attribute name="attrs">{'invisible':[('type','=','url')], 'readonly':[('datas', '!=', False)]}</attribute>
</field>
</field>
</record>
And a part of the original view:
<sheet>
<label for="name" class="oe_edit_only"/>
<h1>
<field name="name"/>
</h1>
<group>
<group>
<field name="type"/>
<field name="datas" filename="datas_fname" attrs="{'invisible':[('type','=','url')]}"/>
<field name="datas_fname" invisible="1" attrs="{'invisible':[('type','=','url')]}" class="oe_inline oe_right"/>
<!-- and so on -->