Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
7545 มุมมอง


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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
3
มิ.ย. 25
1069
1
ม.ค. 25
17962
2
พ.ค. 22
16522
2
ก.พ. 22
29606
1
ม.ค. 20
3941