跳至內容
選單
此問題已被標幟
2 回覆
4277 瀏覽次數

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
4863
1
9月 20
2997
0
6月 18
3307
0
3月 15
5561
2
7月 25
6580