Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
4210 Tampilan

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
Buang
Jawaban Terbai

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
Buang
Penulis Jawaban Terbai

Thank you Ahmed. It has worked perfectly.

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
3
Apr 15
4802
1
Sep 20
2944
0
Jun 18
3258
0
Mar 15
5496
2
Jul 25
6464