Retrieve ID python
I'm trying to retrieve the current ID from a postgre database using
openERP. This is my function (inside a class):
def get_id(self, cr):
cr.execute("SELECT id FROM table ORDER BY id DESC LIMIT 1")
id = cr.fetchone()[0]
return id
Then, I call the function this way:
'last_id':fields.function(get_id, method = True, string = 'ID Number',
type = 'integer')
Although I'm getting this error:
TypeError: get_id() takes exactly 2 arguments (7 given)
what am I doing wrong?
No comments:
Post a Comment