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

 



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

Аватар
Отменить
Лучший ответ

try many2one field for selection widget.

Аватар
Отменить
Автор

in dashboard?

Лучший ответ

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 :)

Аватар
Отменить
Автор

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.

Related Posts Ответы Просмотры Активность
1
авг. 24
1427
2
июн. 24
1869
1
мар. 23
3496
1
окт. 20
3615
1
февр. 20
6811