Odoo Help

3

2
1 Answer
9
Jasad India
9/26/13, 7:24 AM

Hi All,

Finally found out the answer:

eg: 'year': fields.selection([(num, str(num)) for num in range(1900, (datetime.now().year)+1 )], 'Year'),

4 Comments
Bejaoui Souheil Belgium
3/18/15, 4:59 AM

thank you, +1

Corporativo Pepe’ss S.A. de C.V., Diego Calzadilla Mexico
3/26/15, 1:41 PM

great!!

tertiadev Germany
5/9/16, 4:30 AM

Thanks for this good answer! For Odoo 8: year = fields.Selection([(num, str(num)) for num in range( ((datetime.datetime.now().year)-10), ((datetime.datetime.now().year)+1) )] to get the last 10 years as a selection.

cmshitech, Murugan Chinnasamy India
9/14/18, 2:16 AM

This working fine!!!

Ask a Question
Writer
Keep Informed
0 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now