[IMP] ir_sequence: adapt addons code to server changes.
bzr revid: vmt@openerp.com-20110929124858-9nr2gbpuxc6k7ofx
This commit is contained in:
parent
6c1d725c21
commit
6c90db2dde
|
@ -46,23 +46,18 @@ class ir_sequence(osv.osv):
|
|||
'fiscal_ids': fields.one2many('account.sequence.fiscalyear',
|
||||
'sequence_main_id', 'Sequences')
|
||||
}
|
||||
def get_id(self, cr, uid, sequence_id, test='id', context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
cr.execute('select id from ir_sequence where '
|
||||
+ test + '=%s and active=%s', (sequence_id, True,))
|
||||
res = cr.dictfetchone()
|
||||
if res:
|
||||
for line in self.browse(cr, uid, res['id'],
|
||||
context=context).fiscal_ids:
|
||||
if line.fiscalyear_id.id == context.get('fiscalyear_id', False):
|
||||
return super(ir_sequence, self).get_id(cr, uid,
|
||||
line.sequence_id.id,
|
||||
test="id",
|
||||
context=context)
|
||||
return super(ir_sequence, self).get_id(cr, uid, sequence_id, test,
|
||||
context=context)
|
||||
|
||||
def _select_by_code_or_id(self, cr, uid, sequence_code_or_id, code_or_id,
|
||||
for_update_no_wait, context=None):
|
||||
res = super(ir_sequence, self)._select_by_code_or_id(cr, uid,
|
||||
sequence_code_or_id, code_or_id, False, context)
|
||||
if not res:
|
||||
return
|
||||
for line in self.browse(cr, uid, res['id'], context).fiscal_ids:
|
||||
if line.fiscalyear_id.id == context.get('fiscalyear_id'):
|
||||
return super(ir_sequence, self)._select_by_code_or_id(cr, uid,
|
||||
line.sequence_id.id, 'id', False, context)
|
||||
|
||||
ir_sequence()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
Loading…
Reference in New Issue