Hii All,
I want to show total numbers of record on screen. For this i have write query language for function and i get desire result on Ubuntu 14.04 command line screen by printing that value from python code. But when i return this value in function then it shows me error pop-up message "TypeError: 'int' object is not iterable". So, anyone can give me proper solution for this problem. My python code for function and field is below.
Python code:
def get_count(self, cr, uid, ids, sequence, arg, context=None):
cr.execute('SELECT count(*) from sun_helpdesk')
u_data = cr.fetchall()
print "cr:", u_data
print "res:",int(u_data[0][0])
return int(u_data[0][0])
_columns = {
'sequence': fields.function(get_count, method=True, string='Total Tickets', type='integer'),
}
XML code:
In XML this field added simply.
<field name="sequence"/>
Result on the Ubuntu Screen is:
cr: [(101L,)]
res: 101
new_values = dict(values)
TypeError: 'int' object is not iterable