Commit dead3657 authored by Stephane Wirtel's avatar Stephane Wirtel
Browse files

Remove the lock on the table ir_sequence and use FOR UPDATE

bzr revid: stephane@tinyerp.com-20080902180417-lhglzk5lhxacsbw6
parent d4b85840
No related merge requests found
Showing with 1 addition and 2 deletions
+1 -2
......@@ -66,8 +66,7 @@ class ir_sequence(osv.osv):
return (s or '') % {'year':time.strftime('%Y'), 'month': time.strftime('%m'), 'day':time.strftime('%d')}
def get_id(self, cr, uid, sequence_id, test='id=%d'):
cr.execute('lock table ir_sequence')
cr.execute('select id,number_next,number_increment,prefix,suffix,padding from ir_sequence where '+test+' and active=True', (sequence_id,))
cr.execute('select id,number_next,number_increment,prefix,suffix,padding from ir_sequence where '+test+' and active=True FOR UPDATE', (sequence_id,))
res = cr.dictfetchone()
if res:
cr.execute('update ir_sequence set number_next=number_next+number_increment where id=%d and active=True', (res['id'],))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment