Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
4203 มุมมอง

Hi,

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

Regards,

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Thank you Ahmed. It has worked perfectly.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
3
เม.ย. 15
4799
1
ก.ย. 20
2938
0
มิ.ย. 18
3256
0
มี.ค. 15
5494
How to make pop ups after actions? แก้ไขแล้ว
2
ก.ค. 25
6439