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

 



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.

관련 게시물 답글 화면 활동
1
8월 24
1419
2
6월 24
1839
1
3월 23
3489
1
10월 20
3611
1
2월 20
6800