Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
4237 Vistas

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
Mejor respuesta

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 Mejor respuesta

Thank you Ahmed. It has worked perfectly.

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
3
abr 15
4831
1
sept 20
2968
0
jun 18
3275
0
mar 15
5522
2
jul 25
6471