跳至內容
選單
此問題已被標幟
1 回覆
2118 瀏覽次數

I have a many2one relationship that feeds a dropdown menu


I have a filter on the relationship, like this


domain=[('some_field', '=', True)]


this selects the records that appear in the dropdown menu

But if I want to create a new record from the dropdown menu, I'd also like the field "some_field" to be automatically set to True

How can I achieve that ?

I tried

context={'some_field': True}

but it seems it didn't work


Thanks

頭像
捨棄
最佳答案

Hi,

You have to do it is as follows: context={'default_some_field': True}

Passing default value in context: https://www.youtube.com/watch?v=b4SeEVm39pY


Thanks

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
11月 19
7952
1
1月 25
1252
1
3月 24
2711
0
7月 22
2357
3
9月 20
3026