Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
4166 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Autor Nejlepší odpověď

Thank you Ahmed. It has worked perfectly.

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
3
dub 15
4770
1
zář 20
2902
0
čvn 18
3245
0
bře 15
5473
2
čvc 25
6313