Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
4183 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Autore Risposta migliore

Thank you Ahmed. It has worked perfectly.

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
3
apr 15
4786
1
set 20
2913
0
giu 18
3250
0
mar 15
5481
2
lug 25
6345