It is currently Sun Feb 12, 2012 10:26 am

All times are UTC + 2 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: how to get the last inserted id
PostPosted: Tue Jan 19, 2010 2:24 pm 
Offline

Joined: Wed Jan 14, 2009 2:06 pm
Posts: 122
Location: Romania
Hi,

I try many methods to get the last inserted id with no luck. Is there any simple vay to get this id? The cursor must have attribute for returnig the insert id but i can't found.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 19, 2010 4:32 pm 
Offline

Joined: Mon Dec 03, 2007 8:22 am
Posts: 1472
Location: Belgium
Code:
select max(id) from your_obj_name;

above query will return last inserted id.
if you want latest modifies id then you can check on
write_date and create_date fields.

_________________
OpenERP=Easier, Adaptable, Affordable, Modular


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 20, 2010 11:29 am 
Offline

Joined: Wed Jan 14, 2009 2:06 pm
Posts: 122
Location: Romania
thanks for reply!

i tried with luck this:
Code:
last_insert_id = cr.lastrowid


cr.lastrowid gets the oid


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 2 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:

Protected by Anti-Spam ACP