Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
3 Antworten
11378 Ansichten

I want to display the image as readonly on a custom form.

The field is:

<field name="photo" widget='image' options='{"size": [150, 140]}' readonly="1"  />

even after I keep the field as readonly="1" the Edit option appears.

How do I disable the Edit option on image widget?

Avatar
Verwerfen

Hi Hardik, Can you tell me, is this image field a related field like *"fields.related"*, if not then atleast one time you will be updating the image into that field so making it readonly is not useful and although due to image widget it will not become readonly. But If this is a related field than you can go for creating a *"field.function"* for type as *"binary"*, instead of "related" field, which will automatically become a un-editable field. Regards

yes it is bug currenty shows and allows you to click on edit image if it is readonly. it also allows you to select select image but when you will click on save it will not save changes for image as you made it readonly. so you can post issue for that and till solution comes you can go ahed with this readonly=true code;)

hello Hardik shah .. Any solution ,I need the same thing..

this is "fields.binary".

Beste Antwort

See in the comment cannot add code here for some reason 

Avatar
Verwerfen

in css .o_select_file_button{visibility: hidden;}
in xml "<template id="assets_backend"
inherit_id="web.assets_backend"> <xpath expr=".">
<link rel="stylesheet" href="/module_name/static/src/css/css_file_name.css"/>
</xpath></template>"

Beste Antwort

Use CSS for hide.

Avatar
Verwerfen
Beste Antwort
Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
0
März 15
4360
1
Juli 25
2361
1
Mai 20
3567
0
März 20
3602
1
Mai 19
4953