Last active
July 18, 2017 03:25
-
-
Save tienhieuD/dd89646da0f8c5a38ae51b7568a43f44 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@api.model | |
def _get_list_namhoc(self): | |
lst_namhoc=[] | |
for year in range(1990,2050): | |
item = str(year) + "-" + str(year+1) | |
lst_namhoc.append( (item, item) ) | |
return lst_namhoc | |
@api.model | |
def _get_namhoc_now(self): | |
now = datetime.datetime.now() | |
year = now.year | |
if now.month <= 9: | |
year -= 1 | |
return str(year) + "-" + str(year+1) | |
namhoc = fields.Selection( | |
string="Năm học", | |
selection= _get_list_namhoc, | |
default = _get_namhoc_now, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment