[FIX]:cash_register_can_not_open(case:10420)
bzr revid: ira@tinyerp.com-20110704070020-emouw619tw6bmo68
This commit is contained in:
@@ -75,8 +75,7 @@ class ir_sequence(osv.osv):
|
||||
|
||||
def get_id(self, cr, uid, sequence_id, test='id', context=None):
|
||||
assert test in ('code','id')
|
||||
company_id = self.pool.get('res.users').read(cr, uid, uid, ['company_id'], context=context)['company_id'][0] or None
|
||||
child_company_ids = self.pool.get('res.company').search(cr, uid, [('id', 'child_of', [company_id])])
|
||||
company_ids = self.pool.get('res.company').search(cr, uid, [], context=context)
|
||||
cr.execute('''SELECT id, number_next, prefix, suffix, padding
|
||||
FROM ir_sequence
|
||||
WHERE %s=%%s
|
||||
@@ -84,7 +83,7 @@ class ir_sequence(osv.osv):
|
||||
AND (company_id in %%s or company_id is NULL)
|
||||
ORDER BY company_id, id
|
||||
FOR UPDATE NOWAIT''' % test,
|
||||
(sequence_id, tuple(child_company_ids)))
|
||||
(sequence_id, tuple(company_ids)))
|
||||
res = cr.dictfetchone()
|
||||
if res:
|
||||
cr.execute('UPDATE ir_sequence SET number_next=number_next+number_increment WHERE id=%s AND active=true', (res['id'],))
|
||||
|
||||
Reference in New Issue
Block a user