İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
4335 Görünümler

Hi,

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

Regards,

Avatar
Vazgeç
En İyi Yanıt

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 ....

Avatar
Vazgeç
Üretici En İyi Yanıt

Thank you Ahmed. It has worked perfectly.

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
3
Nis 15
4913
1
Eyl 20
3048
0
Haz 18
3355
0
Mar 15
5604
2
Tem 25
6755