Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
4274 Представления

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
4863
1
сент. 20
2997
0
июн. 18
3307
0
мар. 15
5561
2
июл. 25
6580