Se rendre au contenu
Menu
Cette question a été signalée
2 Réponses
4209 Vues

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
Ignorer
Meilleure réponse

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
Ignorer
Auteur Meilleure réponse

Thank you Ahmed. It has worked perfectly.

Avatar
Ignorer
Publications associées Réponses Vues Activité
3
avr. 15
4802
1
sept. 20
2944
0
juin 18
3258
0
mars 15
5495
2
juil. 25
6462