Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
4296 Widoki

Hi,

How to prevent the "Add an item" of One2Many widget from showing a popup form if the parent form is not saved?

Regards,

Awatar
Odrzuć
Najlepsza odpowiedź

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 ....

Awatar
Odrzuć
Autor Najlepsza odpowiedź

Thank you Ahmed. It has worked perfectly.

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
3
kwi 15
4876
1
wrz 20
3019
0
cze 18
3339
0
mar 15
5571
2
lip 25
6651