콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
4334 화면

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
4913
1
9월 20
3048
0
6월 18
3355
0
3월 15
5603
2
7월 25
6754