Skip to Content
Menú
This question has been flagged
2 Respostes
4163 Vistes

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
Descartar
Best Answer

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
Descartar
Autor Best Answer

Thank you Ahmed. It has worked perfectly.

Avatar
Descartar
Related Posts Respostes Vistes Activitat
3
d’abr. 15
4770
1
de set. 20
2901
0
de juny 18
3244
0
de març 15
5473
2
de jul. 25
6310