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


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

ex. 01-2020


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


# 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')

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 6 25
1065
1
thg 1 25
17953
2
thg 5 22
16519
2
thg 2 22
29598
1
thg 1 20
3933