Skip to Content
Menu
This question has been flagged
2 Replies
13139 Views

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
Discard

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?

Best Answer
< field name="your_o2m" style="pointer-events:none;" / >


Avatar
Discard

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.

Best Answer

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
Discard
Author

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!

Related Posts Replies Views Activity
0
Apr 24
1733
0
Jun 22
2154
4
Dec 19
5218
0
May 24
3766
1
Mar 15
6157