跳至内容
菜单
此问题已终结
2 回复
4288 查看

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
4月 15
4870
1
9月 20
3004
0
6月 18
3336
0
3月 15
5566
2
7月 25
6598