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

 



i need to take the values Current Year, Previous year etc. dynamically from a table(model)

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

try many2one field for selection widget.

Ảnh đại diện
Huỷ bỏ
Tác giả

in dashboard?

Câu trả lời hay nhất

Two Ways for this:

1. First you can call a function in selection field to get the options for the field. Here is an example:

@api.model

    def get_field_options(self):

        #compute the list as per your requirement and for the list in format below

        value_list = [('one','option 1'),('two','option 2')]

        return value_list

dynamic_field = fields.Selection(selection='get_field_options', string="Field Dummy")


2. If you just need values from a table as a selection, then try many2one field with selection widget.


Hope this helps :)

Ảnh đại diện
Huỷ bỏ
Tác giả

thanks for the answer shyam. But the actual problem is not this. I want this field to be shown in dashboard as editable selection field.

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 8 24
1416
2
thg 6 24
1836
1
thg 3 23
3487
1
thg 10 20
3610
1
thg 2 20
6797