[FIX]:cash_register_can_not_open(case:10420)

bzr revid: ira@tinyerp.com-20110704070020-emouw619tw6bmo68
This commit is contained in:
Ila Rana
2011-07-04 12:30:20 +05:30
parent 38cf26665d
commit c5c340ec92
+2 -3
View File
@@ -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'],))