[IMP] ir_sequence: adapt addons code to server changes.

bzr revid: vmt@openerp.com-20110929124858-9nr2gbpuxc6k7ofx
This commit is contained in:
Vo Minh Thu 2011-09-29 14:48:58 +02:00
parent 6c1d725c21
commit 6c90db2dde
1 changed files with 12 additions and 17 deletions

View File

@ -46,23 +46,18 @@ class ir_sequence(osv.osv):
'fiscal_ids': fields.one2many('account.sequence.fiscalyear', 'fiscal_ids': fields.one2many('account.sequence.fiscalyear',
'sequence_main_id', 'Sequences') 'sequence_main_id', 'Sequences')
} }
def get_id(self, cr, uid, sequence_id, test='id', context=None):
if context is None: def _select_by_code_or_id(self, cr, uid, sequence_code_or_id, code_or_id,
context = {} for_update_no_wait, context=None):
cr.execute('select id from ir_sequence where ' res = super(ir_sequence, self)._select_by_code_or_id(cr, uid,
+ test + '=%s and active=%s', (sequence_id, True,)) sequence_code_or_id, code_or_id, False, context)
res = cr.dictfetchone() if not res:
if res: return
for line in self.browse(cr, uid, res['id'], for line in self.browse(cr, uid, res['id'], context).fiscal_ids:
context=context).fiscal_ids: if line.fiscalyear_id.id == context.get('fiscalyear_id'):
if line.fiscalyear_id.id == context.get('fiscalyear_id', False): return super(ir_sequence, self)._select_by_code_or_id(cr, uid,
return super(ir_sequence, self).get_id(cr, uid, line.sequence_id.id, 'id', False, context)
line.sequence_id.id,
test="id",
context=context)
return super(ir_sequence, self).get_id(cr, uid, sequence_id, test,
context=context)
ir_sequence() ir_sequence()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: