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

Hi,

How to prevent the "Add an item" of One2Many widget from showing a popup form if the parent form is not saved?

Regards,

アバター
破棄
最善の回答

Hello Emad,

We can do a simple trick. Every model has ID field, will generated automatically after saving, before saving this field has no value.

So in your form view of the parent add

<field name="id" invisible="1"/>

then in your o2m field add attrs like :


<field name="o2m_ids" attrs="{'readonly': [('id','=',False)]}">
<tree editable="bottom">
    ....


I hope it'll help you 


Regards ....

アバター
破棄
著作者 最善の回答

Thank you Ahmed. It has worked perfectly.

アバター
破棄
関連投稿 返信 ビュー 活動
3
4月 15
4911
1
9月 20
3048
0
6月 18
3352
0
3月 15
5601
2
7月 25
6750