[FIX] Remove the useless cr.commit() in the get_id() method of the ir.sequence object
lp bug: https://launchpad.net/bugs/462285 fixed bzr revid: stephane@openerp.com-20100125094123-kg19t7rebg1am1fr
This commit is contained in:
parent
20a4f9aa66
commit
470f5bf125
|
@ -71,17 +71,14 @@ class ir_sequence(osv.osv):
|
|||
}
|
||||
|
||||
def get_id(self, cr, uid, sequence_id, test='id=%s', context=None):
|
||||
try:
|
||||
cr.execute('SELECT id, number_next, prefix, suffix, padding FROM ir_sequence WHERE '+test+' AND active=%s FOR UPDATE', (sequence_id, True))
|
||||
res = cr.dictfetchone()
|
||||
if res:
|
||||
cr.execute('UPDATE ir_sequence SET number_next=number_next+number_increment WHERE id=%s AND active=%s', (res['id'], True))
|
||||
if res['number_next']:
|
||||
return self._process(res['prefix']) + '%%0%sd' % res['padding'] % res['number_next'] + self._process(res['suffix'])
|
||||
else:
|
||||
return self._process(res['prefix']) + self._process(res['suffix'])
|
||||
finally:
|
||||
cr.commit()
|
||||
cr.execute('SELECT id, number_next, prefix, suffix, padding FROM ir_sequence WHERE '+test+' AND active=%s FOR UPDATE', (sequence_id, True))
|
||||
res = cr.dictfetchone()
|
||||
if res:
|
||||
cr.execute('UPDATE ir_sequence SET number_next=number_next+number_increment WHERE id=%s AND active=%s', (res['id'], True))
|
||||
if res['number_next']:
|
||||
return self._process(res['prefix']) + '%%0%sd' % res['padding'] % res['number_next'] + self._process(res['suffix'])
|
||||
else:
|
||||
return self._process(res['prefix']) + self._process(res['suffix'])
|
||||
return False
|
||||
|
||||
def get(self, cr, uid, code):
|
||||
|
|
Loading…
Reference in New Issue