Odoo Help

Welcome!

This community 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.

0

How to print zero in selection field?

By
dheerendra7829
on 1/22/14, 8:38 AM 440 views

Hello Everyone my function is:

def _get_values(self, cr, uid, context=None): l=[]
for i in range(0,21): k=str(i) j=(k,k) l.append(j) return l

I am using that function to print a list(0 to 20) in a selection field. But Zero is not considered in the list, it starts from 1 to 20. Please give me the solution.

Thanks!

Dheerendra

Hi Dheerendra, I just executed the above code in my test.py file and got this output :

[('0', '0'), ('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', ' 6'), ('7', '7'), ('8', '8'), ('9', '9'), ('10', '10'), ('11', '11'), ('12', '12' ), ('13', '13'), ('14', '14'), ('15', '15'), ('16', '16'), ('17', '17'), ('18', '18'), ('19', '19'), ('20', '20')]

It's printing zero. Let me know if i'm missing something :)

Cheers

ASP

ASP
on 1/22/14, 8:51 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 1/22/14, 8:38 AM
Seen: 440 times
Last updated: 3/16/15, 8:10 AM