تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
4239 أدوات العرض

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.

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
3
أبريل 15
4832
1
سبتمبر 20
2970
0
يونيو 18
3280
0
مارس 15
5522
2
يوليو 25
6479