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


Odoo V12. In fields.date, is it possible to display month and year only?

ex. 01-2020


아바타
취소
작성자 베스트 답변


# Outside the model

def get_years(): year_list = [] for i in range(2019, 2030): year_list.append((i, str(i))) return year_list


# Inside the model

month = fields.Selection([(1, 'January'), (2, 'February'), (3, 'March'), (4, 'April'),(5, 'May'), (6, 'June'), (7, 'July'), (8, 'August'),(9, 'September'), (10, 'October'), (11, 'November'), (12, 'December'), ], string='Month')

year = fields.Selection(get_years(), string='Year')

아바타
취소
관련 게시물 답글 화면 활동
3
6월 25
1176
1
1월 25
18024
2
5월 22
16597
2
2월 22
29692
1
1월 20
3992