Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
4299 Weergaven

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
Annuleer
Beste antwoord

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
Annuleer
Auteur Beste antwoord

Thank you Ahmed. It has worked perfectly.

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
3
apr. 15
4877
1
sep. 20
3023
0
jun. 18
3339
0
mrt. 15
5572
2
jul. 25
6653