I have a selection field and this function for list items in field by dynamically.
def get_years(self):
year_list = []
year = date.today().year+1
lastyear = date.today().year - 20
for i in range(int(lastyear),int(year)):
year_list.append((i, str(i)))
return year_list
this is the field,
year = fields.Selection(get_years, string='Yıl', default=get_current_year, restore="True")
and when i save the form, this field become unknown. I found what is the problem but dont know the solution. Problem is compute function, when i write items like [(1997,1997),(2016,2016),(2017,2017)] it is working but i dont want to write hard code. How can i solve this problem. Thank you.