Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
7432 Zobrazení


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

ex. 01-2020


Avatar
Zrušit
Autor Nejlepší odpověď


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

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
3
čvn 25
907
1
led 25
17816
2
kvě 22
16404
2
úno 22
29438
1
led 20
3797