2
2
##############################################################################
4
4
# OpenERP, Open Source Management Solution
5
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
5
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
8
8
# This program is free software: you can redistribute it and/or modify
69
69
'sec': time.strftime('%S'),
72
def get_id(self, cr, uid, sequence_id, test='id=%s'):
73
cr.execute('select id,number_next,number_increment,prefix,suffix,padding from ir_sequence where '+test+' and active=True FOR UPDATE', (sequence_id,))
74
res = cr.dictfetchone()
76
cr.execute('update ir_sequence set number_next=number_next+number_increment where id=%s and active=True', (res['id'],))
77
if res['number_next']:
78
return self._process(res['prefix']) + '%%0%sd' % res['padding'] % res['number_next'] + self._process(res['suffix'])
80
return self._process(res['prefix']) + self._process(res['suffix'])
72
def get_id(self, cr, uid, sequence_id, test='id=%s', context={}):
74
cr.execute('lock table ir_sequence')
75
cr.execute('select id,number_next,number_increment,prefix,suffix,padding from ir_sequence where '+test+' and active=True', (sequence_id,))
76
res = cr.dictfetchone()
78
cr.execute('update ir_sequence set number_next=number_next+number_increment where id=%s and active=True', (res['id'],))
79
if res['number_next']:
80
return self._process(res['prefix']) + '%%0%sd' % res['padding'] % res['number_next'] + self._process(res['suffix'])
82
return self._process(res['prefix']) + self._process(res['suffix'])
83
87
def get(self, cr, uid, code):