コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
7530 ビュー


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
1064
1
1月 25
17952
2
5月 22
16511
2
2月 22
29598
1
1月 20
3928