Skip to Content
Menu
This question has been flagged
2 Replies
4311 Rodiniai

Hi,

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

Regards,

Portretas
Atmesti
Best Answer

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

Portretas
Atmesti
Autorius Best Answer

Thank you Ahmed. It has worked perfectly.

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
3
bal. 15
4896
1
rugs. 20
3038
0
birž. 18
3348
0
kov. 15
5597
2
liep. 25
6717