Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
13490 Visualizzazioni

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
Abbandona

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?

Risposta migliore
< field name="your_o2m" style="pointer-events:none;" / >


Avatar
Abbandona

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.

Risposta migliore

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
Abbandona
Autore

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!

Post correlati Risposte Visualizzazioni Attività
0
apr 24
2076
0
giu 22
2501
4
dic 19
5603
0
mag 24
4053
1
mar 15
6527