Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
2132 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 11 19
7956
1
thg 1 25
1265
1
thg 3 24
2732
0
thg 7 22
2367
3
thg 9 20
3044