コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
13458 ビュー

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!

アバター
破棄

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?

最善の回答
< field name="your_o2m" style="pointer-events:none;" / >


アバター
破棄

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.

最善の回答

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!
アバター
破棄
著作者

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!

関連投稿 返信 ビュー 活動
0
4月 24
2031
0
6月 22
2432
4
12月 19
5545
0
5月 24
4035
1
3月 15
6462