Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
13471 Vistas

Title.

Currently I have a small custom form that allows users to add products to a custom product category. Unfortunately, it's possible to click on an element in the Many2many list while editing a category, which displays the regular form view for editing product information. However, I do not want my users to be able to edit products, at least not this way.

If possible, I'd like to disable the popup completely without having to create and refer to a separate form view (--> e.g. context="{'form_ref_view':my_module.view_name'}"). I have also tried setting all fields to readonly by inheriting the form view, selecting all fields with xpath, and then setting all readonly attributes to 1. When I do that, only the name field of my form view becomes read only, the rest stays editable.

If there's no "elegant" way to do it, I'm open to alternatives.

Thank you in advance!

Avatar
Descartar

Hi Sylvain, this is not working for me, I already add editable="bottom" and editable="top" but still not working for me. Is there any solution for this?

Mejor respuesta
< field name="your_o2m" style="pointer-events:none;" / >


Avatar
Descartar

It's weird, that create, edit, and delete attrs work on form view, but when you try to add it in x2m tree view then it stops working, had to go round and round till I stumbled upon this solution.

Mejor respuesta

Hi!

If you want disable popup,  you can add editable="bottom" or editable="top" through tree view and when user click on the many2many, the pop will not appear but instead the edit is directly in the many2many line.

e.g. :

<field name="move_line_ids">
<tree editable="bottom">
...
</tree>
</field>
Best regards!
Avatar
Descartar
Autor

Thank you so much, that works wonderfully! I also added readonly="True" in the fields, so now users can only add or remove products. You've been a big help!

Publicaciones relacionadas Respuestas Vistas Actividad
0
abr 24
2043
0
jun 22
2461
4
dic 19
5551
0
may 24
4043
1
mar 15
6487